Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save avigail-oron/a4aec3528a8f898b7941f9646af86a8d to your computer and use it in GitHub Desktop.
Save avigail-oron/a4aec3528a8f898b7941f9646af86a8d to your computer and use it in GitHub Desktop.
How run aiakos server against MariaDB alpine
//run a c docker container of aline that declares using port 3306:
docker run -it -p 3306:3306/tcp <docker-alpine-image-id> /bin/sh
//inside the docker container do the following:
apk update
apk add mysql mysql-client
DB_DATA_PATH="/var/lib/mysql"
DB_ROOT_PASS="mariadb_root_password"
DB_USER="mariadb_user"
DB_PASS="mariadb_user_password"
MAX_ALLOWED_PACKET="200M"
mysql_install_db --user=mysql --datadir=${DB_DATA_PATH}
/usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf --user=mysql
//to allow connecting to the DB from other hsosts (+ create the aiakos database), do the following:
mysql
//once inside the mysql client, run the following queries
CREATE USER 'aiakos'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'aiakos'@'localhost' WITH GRANT OPTION;
CREATE USER 'aiakos'@'%' ;
GRANT ALL PRIVILEGES ON *.* TO 'aiakos'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
CREATE DATABASE accounts;
exit
//edit /etc/my.cnf file
//in section [mysqld] add the following:
bind-address = 0.0.0.0
//restart DB so change will take affect
//if running aiakos server from the docker compose, do the following to use our alpine mariaDB instead of the native one:
//edit docker-compose.yml
//remove the mysql service definition
//in all other sections:
//remove the 'depends on' section
//modify the DB URL to be
DATABASE_URL=mysql://aiakos@<the ip or name the DB container is exposing>/accounts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment