From eb5135797ab8c15b36e5a4b2de23ddd2cd4ee0f3 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Fri, 12 Jul 2024 18:15:56 +0000 Subject: [PATCH] fix mariadb service fix mariadb service fix mariadb service fix mariadb service fix mariadb service fix mariadb service fix mariadb service fix mariadb service fix mariadb service --- mariadb/src/helpers.rs | 5 +++-- mariadb/src/lib.rs | 2 +- mysql/src/lib.rs | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mariadb/src/helpers.rs b/mariadb/src/helpers.rs index 8d79328..a9b504f 100644 --- a/mariadb/src/helpers.rs +++ b/mariadb/src/helpers.rs @@ -47,9 +47,10 @@ pub fn setup() -> Result { "flox", "install", "mariadb", "overmind", "tmux" ])? .with_exec(vec!["[ -d $MYSQL_DATADIR ] || mkdir -p $MYSQL_DATADIR"])? - .with_exec(vec!["[ -f $MYSQL_DATADIR/ca.pem ] || flox activate -- mysql_install_db --auth-root-authentication-method=normal --datadir=$MYSQL_DATADIR --pid-file=$MYSQL_HOME/mysql.pid"])? + .with_exec(vec!["touch ~/.my.cnf"])? + .with_exec(vec!["[ -d $MYSQL_DATADIR/sys ] || flox activate -- mysql_install_db --auth-root-authentication-method=normal --user=`whoami` --datadir=$MYSQL_DATADIR --pid-file=$MYSQL_HOME/mysql.pid --defaults-file=~/.my.cnf"])? .with_exec(vec![ - "grep -q mariadb Procfile || echo 'mariadb: mysqld --datadir=$MYSQL_DATADIR --log-error=$MYSQL_HOME/mysql.log --port=$MYSQL_PORT --socket=$MYSQL_HOME/mysql.socket' >> Procfile", + "grep -q mariadb Procfile || echo 'mariadb: mysqld --datadir=$MYSQL_DATADIR --log-error=$MYSQL_HOME/mysql.log --port=$MYSQL_PORT --socket=$MYSQL_HOME/mysql.socket --defaults-file=$HOME/.my.cnf' >> Procfile", ])? .stdout()?; diff --git a/mariadb/src/lib.rs b/mariadb/src/lib.rs index c56f16e..6a355b8 100644 --- a/mariadb/src/lib.rs +++ b/mariadb/src/lib.rs @@ -16,7 +16,7 @@ pub fn start(_args: String) -> FnResult { .with_exec(vec!["type", "mysql"])? .with_exec(vec!["echo -e \"MySQL starting on port $MYSQL_PORT\""])? .with_exec(vec!["overmind", "start", "-f", "Procfile", "--daemonize"])? - .with_exec(vec!["sleep", "2"])? + .wait_on(port.parse()?, None)? .with_exec(vec!["cat", "$MYSQL_HOME/mysql.log"])? .with_exec(vec!["overmind", "status"])? .wait_on(port.parse()?, None)? diff --git a/mysql/src/lib.rs b/mysql/src/lib.rs index c56f16e..bc7ce6b 100644 --- a/mysql/src/lib.rs +++ b/mysql/src/lib.rs @@ -16,10 +16,9 @@ pub fn start(_args: String) -> FnResult { .with_exec(vec!["type", "mysql"])? .with_exec(vec!["echo -e \"MySQL starting on port $MYSQL_PORT\""])? .with_exec(vec!["overmind", "start", "-f", "Procfile", "--daemonize"])? - .with_exec(vec!["sleep", "2"])? + .wait_on(port.parse()?, None)? .with_exec(vec!["cat", "$MYSQL_HOME/mysql.log"])? .with_exec(vec!["overmind", "status"])? - .wait_on(port.parse()?, None)? .stdout()?; Ok(stdout) }