Skip to content

Commit

Permalink
Fix database installation issues
Browse files Browse the repository at this point in the history
Docker bridges and changes in phpipam codebase broke the automatic setup
in some cases.
Fixing this by adding lax constraints on MySQL authentication (from='%').

Signed-off-by: pierrecdn <me@pierre-cheynier.net>
  • Loading branch information
pierrecdn committed Jan 13, 2019
1 parent ef1ba67 commit cb4ec5b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ RUN cp ${WEB_REPO}/config.dist.php ${WEB_REPO}/config.php && \
chown www-data /var/www/html/app/admin/import-export/upload && \
chown www-data /var/www/html/app/subnets/import-subnet/upload && \
chown www-data /var/www/html/css/images/logo && \
echo "\$db['webhost'] = '%';" >> ${WEB_REPO}/config.php && \
sed -i -e "s/\['host'\] = 'localhost'/\['host'\] = getenv(\"MYSQL_ENV_MYSQL_HOST\") ?: \"mysql\"/" \
-e "s/\['user'\] = 'phpipam'/\['user'\] = getenv(\"MYSQL_ENV_MYSQL_USER\") ?: \"root\"/" \
-e "s/\['name'\] = 'phpipam'/\['name'\] = getenv(\"MYSQL_ENV_MYSQL_DB\") ?: \"phpipam\"/" \
-e "s/\['pass'\] = 'phpipamadmin'/\['pass'\] = getenv(\"MYSQL_ENV_MYSQL_PASSWORD\")/" \
-e "s/\['pass'\] = 'phpipamadmin'/\['pass'\] = getenv(\"MYSQL_ENV_MYSQL_ROOT_PASSWORD\")/" \
-e "s/\['port'\] = 3306;/\['port'\] = 3306;\n\n\$password_file = getenv(\"MYSQL_ENV_MYSQL_PASSWORD_FILE\");\nif(file_exists(\$password_file))\n\$db\['pass'\] = preg_replace(\"\/\\\\s+\/\", \"\", file_get_contents(\$password_file));/" \
-e "s/define('BASE', \"\/\")/define('BASE', getenv(\"PHPIPAM_BASE\"))/" \
${WEB_REPO}/config.php
Expand Down

0 comments on commit cb4ec5b

Please sign in to comment.