From 1c66aeb221b452f7cecfdf44afca08ec31d13a64 Mon Sep 17 00:00:00 2001 From: Kristaps Grinbergs Date: Tue, 17 Sep 2024 13:27:52 +0000 Subject: [PATCH] Information how to use docker with MySQL --- include/fassets/setup-mysql.md | 49 +++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/include/fassets/setup-mysql.md b/include/fassets/setup-mysql.md index 56cd81fc0..c78028713 100644 --- a/include/fassets/setup-mysql.md +++ b/include/fassets/setup-mysql.md @@ -1,6 +1,53 @@ ### Setting up MySQL Database -You must set up a MySQL database to continue with this process. For detailed instructions and additional guidance, refer to the official [MySQL documentation](https://dev.mysql.com/doc/). +To proceed with this process, you must set up a MySQL database. You have two options: using Docker (preferred) or installing it manually. + +#### Setting up MySQL Database with Docker + +1. Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop/). +2. Create a `docker-compose.yml` file in your directory, add the following lines, and change the value of `VerySafePassword` according to your security standards: + ```docker + version: '3.8' + + services: + mysql: + image: mysql:8.0 + restart: always + hostname: mysql + environment: + MYSQL_ROOT_PASSWORD: 'root' + MYSQL_DATABASE: 'fasset_bots' + MYSQL_USER: 'fassetbot' + MYSQL_PASSWORD: 'VerySafePassword' + volumes: + - ./data:/var/lib/mysql + - ./init.mysql.sql:/docker-entrypoint-initdb.d/init.mysql.sql # Initialization SQL file + ports: + - "3306:3306" + healthcheck: + test: ['CMD', 'mysqladmin', 'ping', '-h', '127.0.0.1', '-u', 'root', '-p$MYSQL_ROOT_PASSWORD'] + timeout: 20s + retries: 10 + ``` +3. Create a file named `init.mysql.sql` in the same directory, add the following lines, and change the value of `VerySafePassword` according to your security standards: + ```sql + CREATE USER IF NOT EXISTS 'fassetbot'@'%' IDENTIFIED BY 'my1beta2password3'; + GRANT ALL PRIVILEGES ON *.* TO 'fassetbot'@'%' WITH GRANT OPTION; + GRANT ALL PRIVILEGES ON fasset_bots.* TO 'fassetbot'@'%' WITH GRANT OPTION; + ``` +4. Start the MySQL server as a Docker container by running `docker-compose up -d`. After the MySQL database is started, it will continue to run in the background every time you run the agent. +5. In the `secrets.json` file, add this block to the list to set the `user` and `password` for the database, and change the value of `password` to the same password you have been using. + ``` + "database": { + "user": "fassetbot", + "password": "my1beta2password3" + } + ``` +6. In the `config.json` file, update the value of `extends` to `coston-bot-mysql.json`. + +#### Setting up MySQL Database Manually + +To install the MySQL database manually, refer to the official [MySQL documentation](https://dev.mysql.com/doc/). You can find MySQL database connection parameters in the file listed as the value for the variable `FASSET_BOT_CONFIG` in the `.env` file.