bioatlas / ala-docker

Dockerized version of Atlas of Living Australia components
GNU Affero General Public License v3.0
12 stars 12 forks source link

make dotfiles - does not work on Mac #27

Closed steinho closed 2 years ago

steinho commented 6 years ago

output:

Steins-MBP:ala-docker steinarildhoem$ sudo make dotfiles Password:

echo "# Make this unique, and don't share it with anybody.\n# This value was autogenerated." > secrets

rm -f secrets env/{.envapi,.envcollectory,.envimage,.envlogger}

printf "export SECRET_MYSQL_ROOT_PASSWORD=%b\n" \ $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 50) >> secrets tr: Illegal byte sequence printf "export SECRET_MYSQL_PASSWORD=%b\n" \ $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 50) >> secrets tr: Illegal byte sequence printf "export SECRET_POSTGRES_PASSWORD=%b\n" \ $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 50) >> secrets tr: Illegal byte sequence printf "export SECRET_MIRROREUM_PASSWORD=%b\n" \ $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 50) >> secrets tr: Illegal byte sequence bash -c ". secrets && envsubst < env/envapi.template > env/.envapi" bash -c ". secrets && envsubst < env/envcollectory.template > env/.envcollectory" bash -c ". secrets && envsubst < env/envimage.template > env/.envimage" bash -c ". secrets && envsubst < env/envlogger.template > env/.envlogger" bash -c ". secrets && envsubst < env/envmirroreum.template > env/.envmirroreum" bash -c ". secrets && envsubst < env/envwordpress.template > env/.envwordpress" rm -f secrets

output from image mysqldb: error: database is uninitialized and password option is not specified You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD ... might be related to above problem

mskyttner commented 6 years ago

Thanks for reporting Mac-related issues! Could this be related to this post?

OSX and /dev/urandom and tr

If so, a solution is suggested there... Other solutions would be possible.... One idea here would be to have a separate container to do these kind of init steps - thereby moving it away from the host and making it portable - not requiring the host to have the envsubst command or a /dev/urandom device ...

It could be a small Alpine container that does necessary seeding, it would need to have envsubst (gettext) and mount the env directory where it would generate the dotfiles.

Also - since there is now support for "secrets" in Docker - perhaps the swarm/cluster-friendly solution to this might be to use Docker Secrets as suggested in this SO post

steinho commented 6 years ago

Changed this part in makefile

ecrets:

echo "# Make this unique, and don't share it with anybody.\n# This value was autogenerated." > $@

#rm -f secrets env/{.envapi,.envcollectory,.envimage,.envlogger}
printf "export SECRET_MYSQL_ROOT_PASSWORD=%b\n" \
    $$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 50) >> $@
printf "export SECRET_MYSQL_PASSWORD=%b\n" \
    $$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 50) >> $@
printf "export SECRET_POSTGRES_PASSWORD=%b\n" \
    $$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 50) >> $@
printf "export SECRET_MIRROREUM_PASSWORD=%b\n" \
    $$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 50) >> $@
steinho commented 6 years ago

... secrets

mskyttner commented 6 years ago

Fixed on the develop branch using the approach earlier mentioned in the comments. This issue will be closed when merged into master, unless @steinho reports more issues related to this issue.