Skip to content

Commit f8b26f6

Browse files
committed
Add Fix MariaDB/MySQL detection, add my.cnf to mariadb
1 parent eca9c25 commit f8b26f6

File tree

5 files changed

+40
-33
lines changed

5 files changed

+40
-33
lines changed

plugins/builtins.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ var builtInMap = map[*regexp.Regexp]string{
2828
regexp.MustCompile(`^(apache|apacheHttpd)$`): "apacheHttpd",
2929
regexp.MustCompile(`^(gradle|gradle_[0-9])$`): "gradle",
3030
regexp.MustCompile(`^(ghc|haskell\.compiler\.(.*))$`): "haskell",
31-
regexp.MustCompile(`^mariadb(-embedded)?_?[0-9]*$`): "mariadb",
32-
regexp.MustCompile(`^mysql?[0-9]*$`): "mysql",
31+
regexp.MustCompile(`(^mariadb(-embedded)?_?[0-9]*$|^mysql$)`): "mariadb",
32+
regexp.MustCompile(`^mysql(80|57|50)$`): "mysql",
3333
regexp.MustCompile(`^nodejs(-slim)?_?[0-9]*$`): "nodejs",
3434
regexp.MustCompile(`^php[0-9]*$`): "php",
3535
regexp.MustCompile(`^python3[0-9]*Packages.pip$`): "pip",

plugins/mariadb.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"{{ .Virtenv }}/run": "",
1414
"{{ .Virtenv }}/flake/flake.nix": "mariadb/flake.nix",
1515
"{{ .Virtenv }}/setup_db.sh": "mariadb/setup_db.sh",
16-
"{{ .Virtenv }}/process-compose.yaml": "mariadb/process-compose.yaml"
16+
"{{ .Virtenv }}/process-compose.yaml": "mariadb/process-compose.yaml",
17+
"{{ .DevboxDir }}/my.cnf": "mariadb/my.cnf"
1718
},
1819
"packages": {
1920
"path:{{ .Virtenv }}/flake": {},

plugins/mariadb/my.cnf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# MySQL configuration file
2+
3+
[mariadb]
4+
log_error=mysql.log

plugins/mariadb/setup_db.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ if [ ! -d "$MYSQL_DATADIR" ]; then
66
--datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR \
77
--pid-file=$MYSQL_PID_FILE
88
fi
9+
10+
if [ -e "$MYSQL_CONF" ]; then
11+
ln -fs "$MYSQL_CONF" "$MYSQL_HOME/my.cnf"
12+
fi

plugins/mysql.json

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
{
2-
"name": "mysql",
3-
"version": "0.0.4",
4-
"description": "* This plugin wraps mysqld and mysql_install_db to work in your local project\n* This plugin will create a new database for your project in MYSQL_DATADIR if one doesn't exist on shell init. This DB will be started in `insecure` mode, so be sure to add a root password after creation if needed.\n* Use mysqld to manually start the server, and `mysqladmin -u root shutdown` to manually stop it",
5-
"env": {
6-
"MYSQL_BASEDIR": "{{ .DevboxProfileDefault }}",
7-
"MYSQL_HOME": "{{ .Virtenv }}/run",
8-
"MYSQL_DATADIR": "{{ .Virtenv }}/data",
9-
"MYSQL_UNIX_PORT": "{{ .Virtenv }}/run/mysql.sock",
10-
"MYSQL_PID_FILE": "{{ .Virtenv }}/run/mysql.pid",
11-
"MYSQL_CONF": "{{ .DevboxDir }}/my.cnf"
12-
},
13-
"create_files": {
14-
"{{ .Virtenv }}/run": "",
15-
"{{ .Virtenv }}/flake/flake.nix": "mysql/flake.nix",
16-
"{{ .Virtenv }}/setup_db.sh": "mysql/setup_db.sh",
17-
"{{ .Virtenv }}/process-compose.yaml": "mysql/process-compose.yaml",
18-
"{{ .DevboxDir }}/my.cnf": "mysql/my.cnf"
19-
},
20-
"packages": {
21-
"path:{{ .Virtenv }}/flake": {},
22-
"glibcLocales": {
23-
"version": "latest",
24-
"platforms": ["x86_64-linux", "aarch64-linux"]
25-
}
26-
},
27-
"__remove_trigger_package": true,
28-
"shell": {
29-
"init_hook": [
30-
"bash {{ .Virtenv }}/setup_db.sh"
31-
]
2+
"name": "mysql",
3+
"version": "0.0.4",
4+
"description": "* This plugin wraps mysqld and mysql_install_db to work in your local project\n* This plugin will create a new database for your project in MYSQL_DATADIR if one doesn't exist on shell init. This DB will be started in `insecure` mode, so be sure to add a root password after creation if needed.\n* Use mysqld to manually start the server, and `mysqladmin -u root shutdown` to manually stop it",
5+
"env": {
6+
"MYSQL_BASEDIR": "{{ .DevboxProfileDefault }}",
7+
"MYSQL_HOME": "{{ .Virtenv }}/run",
8+
"MYSQL_DATADIR": "{{ .Virtenv }}/data",
9+
"MYSQL_UNIX_PORT": "{{ .Virtenv }}/run/mysql.sock",
10+
"MYSQL_PID_FILE": "{{ .Virtenv }}/run/mysql.pid",
11+
"MYSQL_CONF": "{{ .DevboxDir }}/my.cnf"
12+
},
13+
"create_files": {
14+
"{{ .Virtenv }}/run": "",
15+
"{{ .Virtenv }}/flake/flake.nix": "mysql/flake.nix",
16+
"{{ .Virtenv }}/setup_db.sh": "mysql/setup_db.sh",
17+
"{{ .Virtenv }}/process-compose.yaml": "mysql/process-compose.yaml",
18+
"{{ .DevboxDir }}/my.cnf": "mysql/my.cnf"
19+
},
20+
"packages": {
21+
"path:{{ .Virtenv }}/flake": {},
22+
"glibcLocales": {
23+
"version": "latest",
24+
"platforms": ["x86_64-linux", "aarch64-linux"]
3225
}
26+
},
27+
"__remove_trigger_package": true,
28+
"shell": {
29+
"init_hook": ["bash {{ .Virtenv }}/setup_db.sh"]
3330
}
31+
}

0 commit comments

Comments
 (0)