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

setup.sh does not create or prepare the kolide database #3

Open
TonyLeeVT opened this issue May 9, 2019 · 1 comment
Open

setup.sh does not create or prepare the kolide database #3

TonyLeeVT opened this issue May 9, 2019 · 1 comment

Comments

@TonyLeeVT
Copy link

Thanks again for the great work. After running setup.sh and then running "service fleet-service status", I see the following error:

May 08 18:24:21 ubuntu fleet-service[19893]: {"mysql":"could not connect to db: Error 1049: Unknown database 'kolide', sleeping 1s","ts":"2019-05-09T01:24:21.147892244Z"}

It appears that the kolide database is not created.

Something similar to the following should work in your script:
mysql -uroot -p${MYSQL_PASS} -e "create database kolide"

Then after that, there will be another error:
May 08 18:42:35 ubuntu fleet-service[20023]: Using config file: /opt/fleet//conf/fleet.yaml
May 08 18:42:35 ubuntu fleet-service[20023]: ################################################################################
May 08 18:42:35 ubuntu fleet-service[20023]: # ERROR:
May 08 18:42:35 ubuntu fleet-service[20023]: # Your Fleet database is not initialized. Fleet cannot start up.
May 08 18:42:35 ubuntu fleet-service[20023]: #
May 08 18:42:35 ubuntu fleet-service[20023]: # Run /usr/bin/fleet prepare db to initialize the database.
May 08 18:42:35 ubuntu fleet-service[20023]: ################################################################################

Something similar to the following should work in your script:
/usr/bin/fleet prepare db --mysql_address=127.0.0.1:3306 --mysql_database=kolide --mysql_username=root --mysql_password=${MYSQL_PASS}

@TonyLeeVT
Copy link
Author

The suggested fixes above have been verified from a clean install. The end of the install.sh file now reads (new content in code blocks):

--SNIP--

create the system v service and run it at startup

sudo cp $ISERVICE $FSERVICE
sudo chmod a+x $FSERVICE
sudo update-rc.d $SERVICE defaults
sudo update-rc.d $SERVICE enable

# create the kolide database within mysql
mysql -uroot -p${MYSQL_PASS} -e "create database kolide"

# prepare the kolide database
/usr/bin/fleet prepare db --mysql_address=127.0.0.1:3306 --mysql_database=kolide --mysql_username=root --mysql_password=${MYSQL_PASS}

$FSERVICE start

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

1 participant