Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for External Database like RDS #68

Open
adv4000 opened this issue Mar 30, 2021 · 3 comments
Open

Support for External Database like RDS #68

adv4000 opened this issue Mar 30, 2021 · 3 comments

Comments

@adv4000
Copy link

adv4000 commented Mar 30, 2021

Do you have any draft for support External Database and not use only local DB?
So it can be configured using parameter MYSQL_MISP_HOST in addition to MYSQL_MISP_PASSWORD

@ventz
Copy link
Collaborator

ventz commented Mar 30, 2021

@adv4000 No, but it should be pretty easy for you add it:

Essentially modifying the init-db to include "host":

echo "#!/bin/bash" > /init-db ; \

And then adding a host like this:

RUN sed -i -e 's/db login/misp/g' /var/www/MISP/app/Config/database.php ; \

and here:

echo "sudo -u www-data -H sh -c \"mysql -u misp -p$MYSQL_MISP_PASSWORD misp < /var/www/MISP/INSTALL/MYSQL.sql\"" >> /init-db ; \

And (optionally) removing service here:

[program:mysql]

@adv4000
Copy link
Author

adv4000 commented Mar 30, 2021

Thanks, working on it now...

@adv4000
Copy link
Author

adv4000 commented Mar 30, 2021

Into build.sh added:

    --build-arg MYSQL_MISP_USERNAME=adminuser \
    --build-arg MYSQL_MISP_PASSWORD=adminpass \
    --build-arg MYSQL_MISP_ENDPOINT=misp-mysql.xxx.us-west-2.rds.amazonaws.com \
    --build-arg MYSQL_MISP_DBNAME=mispdb \

Inside Dockerfile Added/Updated:

ARG MYSQL_MISP_USERNAME=demouser
ARG MYSQL_MISP_PASSWORD=demopass
ARG MYSQL_MISP_ENDPOINT=mysql-rds.us-west-2.rds.amazonaws.com
ARG MYSQL_MISP_DBNAME=mispdbdemo

RUN sed -i -e "s/misp/${MYSQL_MISP_DBNAME}/g"          /var/www/MISP/app/Config/database.php ; \
    sed -i -e "s/db login/${MYSQL_MISP_USERNAME}/g"    /var/www/MISP/app/Config/database.php ; \
    sed -i -e "s/db password/${MYSQL_MISP_PASSWORD}/g" /var/www/MISP/app/Config/database.php ; \
    sed -i -e "s/localhost/${MYSQL_MISP_ENDPOINT}/g"   /var/www/MISP/app/Config/database.php ; \
    echo "sudo -u www-data -H sh -c \"mysql -h ${MYSQL_MISP_ENDPOINT} -u ${MYSQL_MISP_USERNAME} -p$MYSQL_MISP_PASSWORD ${MYSQL_MISP_DBNAME} < /var/www/MISP/INSTALL/MYSQL.sql\"" >> /init-db ; \

And removed many lines with local db folder usage.
Seems like working fine :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants