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

Possible removal of MySQL resources #177

Closed
jtopjian opened this issue Jul 16, 2016 · 3 comments
Closed

Possible removal of MySQL resources #177

jtopjian opened this issue Jul 16, 2016 · 3 comments

Comments

@jtopjian
Copy link
Collaborator

jtopjian commented Jul 16, 2016

I've written a mysql_user and mysql_grant resource for Terraform to go along with the existing mysql_database resource. If those get merge, I might remove the MySQL resources from Waffles.

@gbraekmans
Copy link
Contributor

Why? I could understand removing users and grant. But I would certainly keep a mysql resource with the ability to seed the initial mysql db.

@jtopjian
Copy link
Collaborator Author

This definitely isn't a final decision -- more of a poll / open question to come back to later.

One design characteristic I want to try to stick to is ensuring Waffles isn't doing something another complementary tool is doing better.

The Waffles MySQL resources are key to bootstrapping a MySQL server (single or cluster). An example can be seen here. What I'm debating is whether or not they would serve a purpose beyond that. Given they're so key to bootstrapping, that alone might make them worthwhile to keep in Waffles, though.

Beyond that, though, I feel like having the MySQL resources included in configurations of non-MySQL servers is clunky. As an example, here's the configuration of a fictional wiki server:

Terraform:

resource "openstack_compute_instance_v2" "dokuwiki" {
  name = "dokuwiki"
  image_name = "Ubuntu 14.04"
  etc etc

  provisioner "file" {
    source = "files/waffles-dokuwiki.sh"
    destination = "/home/ubuntu/waffles-dokuwiki.sh"
  }

  provisioner "remote-exec" {
    inline = [ "sudo bash /home/ubuntu/waffles-dokuwiki.sh" ]
  }
}

and waffles-dokuwiki.sh would look something like:

apt.pkg --package mysql-client
apt.pkg --package dokuwiki
mysql.mycnf --file /root/.my.cnf --user root --password password --host mysql.example.com
mysql.database --name dokuwiki
mysql.user --user dokuwiki --host $(hostname) --password password
mysql.grant --user dokuwiki --host $(hostname) --database dokuwiki --privileges ALL
os.file --source dokuwiki.conf --destination /var/www/dokuwiki/dokuwiki.conf

By using the MySQL Terraform resources, it would look like:

Terraform:

provider "mysql" {
  username = "root"
  password = "password"
  host = "mysql.example.com"
}

resource "mysql_database" {
  name = "dokuwiki"
}

resource "mysql_user" {
  user = "dokuwiki"
  host = "foobar.com"
}

resource "mysql_grant" {
  user = "dokuwiki"
  host = "foobar.com"
  database = "dokuwiki"
  privileges = ["ALL"]
}

resource "openstack_compute_instance_v2" "dokuwiki" {
  name = "dokuwiki"
  image_name = "Ubuntu 14.04"
  etc etc

  provisioner "file" {
    source = "files/waffles-dokuwiki.sh"
    destination = "/home/ubuntu/waffles-dokuwiki.sh"
  }

  provisioner "remote-exec" {
    inline = [ "sudo bash /home/ubuntu/waffles-dokuwiki.sh" ]
  }
}

and waffles-dokuwiki.sh would look something like:

apt.pkg --package dokuwiki
os.file --source dokuwiki.conf --destination /var/www/dokuwiki/dokuwiki.conf

The design between the two is definitely subjective -- that's why I'm still debating this. But the main reasons I brought this topic up is because:

  1. Is managing the MySQL resources outside of Waffles more beneficial than maintaining the MySQL resources in Waffles?
  2. In order to use the MySQL resources with Waffles, especially on a non-mysql server, the mysql-client package needs installed. Is this too heavy of a requirement for, say, a thin container?
  3. Is the decision to force a user to use another tool for management of MySQL resources too harsh / opinionated?

Ultimately, I think the resources will stay in Waffles. This whole issue is more or less just thinking out loud and to get input from other people -- which very much has a bearing on the decision, so any push back is definitely appreciated. 😄

@jtopjian
Copy link
Collaborator Author

Especially to help in bootstrapping new MySQL servers, I've decided to leave these resources in. :)

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

No branches or pull requests

2 participants