Skip to content

Commit

Permalink
fix(mysql): specify socket path
Browse files Browse the repository at this point in the history
fix(mysql): specify socket path

[mysql] log errors

fix(mysql): add --datadir param

fix(mysql): detect empty data dir
  • Loading branch information
tsirysndr committed Jul 12, 2024
1 parent 0839a0f commit e45181a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mysql/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ pub fn setup() -> Result<String, Error> {
"flox", "install", "mysql84", "overmind", "tmux"
])?
.with_exec(vec!["[ -d $MYSQL_DATADIR ] || mkdir -p $MYSQL_DATADIR"])?
.with_exec(vec!["[ -z \"$(ls -A $MYSQL_DATADIR)\" ] && flox activate -- mysqld --initialize-insecure --datadir=$MYSQL_DATADIR --basedir=$MYSQL_HOME --log-error=$MYSQL_HOME/mysql.log"])?
.with_exec(vec!["[ -f $MYSQL_DATADIR/ca.pem ] && flox activate -- mysqld --initialize-insecure --datadir=$MYSQL_DATADIR --log-error=$MYSQL_HOME/mysql.log"])?
.with_exec(vec![
"grep -q mysql Procfile || echo 'mysql: mysqld --log-error=$MYSQL_HOME/mysql.log --port=$MYSQL_PORT' >> Procfile",
"grep -q mysql Procfile || echo 'mysql: mysqld --datadir=$MYSQL_DATADIR --log-error=$MYSQL_HOME/mysql.log --port=$MYSQL_PORT --socket=$MYSQL_HOME/mysql.socket' >> Procfile",
])?
.stdout()?;

Expand Down
1 change: 1 addition & 0 deletions mysql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub fn start(_args: String) -> FnResult<String> {
.with_exec(vec!["echo -e \"MySQL starting on port $MYSQL_PORT\""])?
.with_exec(vec!["overmind", "start", "-f", "Procfile", "--daemonize"])?
.with_exec(vec!["sleep", "2"])?
.with_exec(vec!["cat", "$MYSQL_HOME/mysql.log"])?
.with_exec(vec!["overmind", "status"])?
.wait_on(port.parse()?, None)?
.stdout()?;
Expand Down

0 comments on commit e45181a

Please sign in to comment.