imagegenius / docker-semaphore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mysql connection not using the host and port specified

brycelarge opened this issue · comments

Hi there,

Here is the docker run script:

docker run
  -d
  --name='semaphore'
  --net='bridge'
  -e 'SEMAPHORE_DB_DIALECT'='mysql'
  -e 'SEMAPHORE_ADMIN'='admin'
  -e 'SEMAPHORE_ADMIN_PASSWORD'='somepass'
  -e 'SEMAPHORE_ADMIN_NAME'='someone'
  -e 'SEMAPHORE_ADMIN_EMAIL'='someone@somewhere'
  -e 'SEMAPHORE_ACCESS_KEY_ENCRYPTION'='9946NyKhSqwfqeqwfqwfqwfqw5CH+kg='
  -e 'SEMAPHORE_DB_HOST'='192.168.1.2'
  -e 'SEMAPHORE_DB_PORT'='3309'
  -e 'SEMAPHORE_DB_USER'='semaphore'
  -e 'SEMAPHORE_DB_PASS'='somepassword'
  -e 'SEMAPHORE_DB'='semaphore'
  -p '3000:3000/tcp'
  -v '/semaphore':'/config':'rw' 'ghcr.io/imagegenius/semaphore' 

Here is the container errors:

/go/src/github.com/ansible-semaphore/semaphore/cli/main.go:8 +0x17
time="2023-10-12T09:07:22+02:00" level=warning msg="Error 1045: Access denied for user 'semaphore'@'172.17.0.1' (using password: YES)"
panic: Error 1045: Access denied for user 'semaphore'@'172.17.0.1' (using password: YES)

what does printenv show within the container?

what does printenv show within the container?

SEMAPHORE_TMP_PATH=/tmp/semaphore
SEMAPHORE_DB_HOST=192.168.1.2
PUID=99
SEMAPHORE_ADMIN=admin
HOSTNAME=fddb2f5d6bd9
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
SEMAPHORE_ADMIN_EMAIL=someone@somewhere.com
HOST_CONTAINERNAME=semaphore
UMASK=022
PWD=/
TZ=Africa/Johannesburg
SEMAPHORE_DB=semaphore
HOME=/config
PGID=100
VIRTUAL_ENV=/lsiopy
SEMAPHORE_ADMIN_NAME=Somneone
S6_VERBOSITY=1
S6_STAGE2_HOOK=/docker-mods
SEMAPHORE_ACCESS_KEY_ENCRYPTION=6646NyKsomekeykeyvm6Z4n36d5WZ5CH+kg=
TERM=xterm
HOST_OS=Unraid
SEMAPHORE_DB_PORT=3309
SHLVL=1
SEMAPHORE_DB_DIALECT=mysql
SEMAPHORE_CONFIG_PATH=/config
SEMAPHORE_DB_PASS=somepass24525
PS1=$(whoami)@$(hostname):$(pwd)$
PATH=/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOST_HOSTNAME=myserver
SEMAPHORE_DB_USER=semaphore
SEMAPHORE_ADMIN_PASSWORD=somepassword
SEMAPHORE_DB_PATH=/config

PS1 value is suspect but dont think that would cause this issue

It is indeed working, looks like mysql is not configured so that the user semaphore is allowed to connect from 172.17.0.1, update the user so that it allows connections from anywhere % or 172.17.0.1

Thanks for the quick assistance.

Tried that, perhaps its not connecting to the correct port, I have mysql running on many ports. Let me test the 3306 instance

image

Confirmed its connecting to 3306 not the specified SEMAPHORE_DB_PORT of 3309

is this a limitation of semaphore or is there something else going on?

Semaphore requires the port be part of SEMAPHORE_DB_HOST as it knows nothing about SEMAPHORE_DB_PORT. e.g. SEMAPHORE_DB_HOST=192.168.0.2:4306

Semaphore requires the port be part of SEMAPHORE_DB_HOST as it knows nothing about SEMAPHORE_DB_PORT. e.g. SEMAPHORE_DB_HOST=192.168.0.2:4306

https://docs.semui.co/administration-guide/installation#docker, SEMAPHORE_DB_PORT is marked as a variable here

Semaphore requires the port be part of SEMAPHORE_DB_HOST as it knows nothing about SEMAPHORE_DB_PORT. e.g. SEMAPHORE_DB_HOST=192.168.0.2:4306

https://docs.semui.co/administration-guide/installation#docker, SEMAPHORE_DB_PORT is marked as a variable here

Yes but the Semphore code doesn't do anything with SEMAPHORE_DB_PORT. The port needs to be specified with SEMAPHORE_DB_HOST. SEMAPHORE_DB_PORT simply isn't implemented (yet).