Open akaihola opened 9 years ago
@akaihola adding shopt -s nocasematch
and replacing [
with [[
in the entrypoint.sh
script should probably resolve this. This change would require a bit of testing to make sure it does not break anything.
@akaihola If you find the time can you apply the patch https://gist.github.com/sameersbn/dc6a684394f21f790f75, build and test with ansible?
@akaihola I tried this out. For the most part it works. But would cause problems in the yaml files where the truth value would be set to True
. I don't think yaml would like that.
I think the best and quickest solution is to use quotes in the sample docker-compose.yml file.
Hi, on my system (Debian Jessie, with docker-compose 1.2.0-1 installed from Stretch), the quotes in SMTP_STARTTLS="true"
prevented config/initializers/smtp_settings.rb
to be properly initialised with the contents of SMTP_HOST
and the like. Removing the quotes solved the problem.
thanks for reporting this @charles-plessy. I have removed the quotes from the docker compose file now.
Hi,
There is a problem, everytime I set --env='SMTP_HOST=smtp.163.com'
then ,I get this message Unable to find image ' :latest' locally
.And I don't have any idea about this. Does it only support Gmail ?
@jiajar no.. It supports other mail hosts as well. Please provide your docker command line for me to take a closer look at whats wrong.
There is my command docker run --name=gitlab -d \ --link=redis-gitlab:redisio \ --link=mysql-gitlab:mysql \ --publish=10022:22 --publish=10080:80 \ --env='GITLAB_PORT=10080' --env='GITLAB_SSH_PORT=10022' \ --env='SMTP_ENABLED=true' \ --env='SMTP_DOMAIN=163.com' \ --env='SMTP_HOST=smtp.163.com' --env='SMTP_PORT=25' \ --env='SMTP_USER=name@163.com' --env='SMTP_PASS=passwd' \ --volume=/srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:latest
@jiajar the command you pasted above has a space character after the \
character on the --env='SMTP_DOMAIN=163.com' \
line. Remove it an retry.
docker run --name=gitlab -d \
--link=redis-gitlab:redisio \
--link=mysql-gitlab:mysql \
--publish=10022:22 --publish=10080:80 \
--env='GITLAB_PORT=10080' --env='GITLAB_SSH_PORT=10022' \
--env='SMTP_ENABLED=true' \
--env='SMTP_DOMAIN=163.com' \
--env='SMTP_HOST=smtp.163.com' --env='SMTP_PORT=25' \
--env='SMTP_USER=name@163.com' --env='SMTP_PASS=passwd' \
--volume=/srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:latest
oh dear,that is ! Thanks !
I can confirm that quoting the string in the Ansible task did help. Adding the shopt
line worked as well. Thanks a lot!
I can confirm the same behavior using docker compose.
Aaaah, @akaihola, I just spent about 1-2 hours debugging SMTP. Thanks for this!
This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.
entrypoint.sh
copies SMTP configuration from environment variables only ifSMTP_ENABLED
is the string"true"
, orSMTP_ENABLED
is blank or missing andSMTP_USER
has a value.When using Ansible's docker module, the environment can be passed to the container like this:
The gotcha here is that Ansible tries to be smart and turns the identifier
true
into the boolean PythonTrue
value. Thedocker-py
API client in turn converts that to the string"True"
, which isn't recognized as a true value byentrypoint.sh
.The solution is to either
SMTP_ENABLED: "true"
in the Ansible task, orSMTP_ENABLED
and make sureSMTP_USER
is set.I'd hate anyone else to waste as many hours as I did debugging this, so would it be reasonable to make the true value detection case insensitive?