Skip to content

Commit 7b1b831

Browse files
committed
another startup workaround try
1 parent f7b788b commit 7b1b831

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

group.nomad

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,36 @@ task "db" {
1515
tty = true
1616
tmpfs = ["/tmp", "/run"]
1717
command = "sh"
18+
1819
args = [
1920
"-c",
20-
"/usr/local/bin/docker-entrypoint.sh mysqld; echo FAIL WHALE; cat /var/lib/mysql/*err; sleep 300"
21+
<<EOF
22+
# Initialize DB if needed
23+
if [ ! -d "/var/lib/mysql/mysql" ]; then
24+
mysqld --initialize-insecure --user=mysql --datadir=/var/lib/mysql
25+
fi
26+
27+
# Start mysqld directly (no entrypoint wrapper)
28+
exec mysqld \
29+
--user=mysql \
30+
--datadir=/var/lib/mysql \
31+
--default-authentication-plugin=mysql_native_password \
32+
--init-file=<(cat <<EOSQL
33+
CREATE DATABASE IF NOT EXISTS demo-db;
34+
CREATE USER IF NOT EXISTS 'demo-user'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';
35+
GRANT ALL PRIVILEGES ON demo-db.* TO 'demo-user'@'%';
36+
FLUSH PRIVILEGES;
37+
EOSQL
38+
)
39+
EOF
40+
]
41+
42+
# args = [
43+
# "-c",
44+
# "/usr/local/bin/docker-entrypoint.sh mysqld; echo FAIL WHALE; cat /var/lib/mysql/*err; sleep 300"
2145
# "/usr/local/bin/docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password || sleep 300"
2246
# "exec /usr/local/bin/docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
23-
]
47+
# ]
2448
}
2549

2650
# xxx

0 commit comments

Comments
 (0)