dosubot[bot] commented on issue #7864:
URL:
https://github.com/apache/incubator-devlake/issues/7864#issuecomment-2273980850
<!-- Answer -->
To connect a MySQL RDS instance to use as the database in your
`docker-compose` file for DevLake, follow these steps:
1. **Set the `mysql.useExternal` value to `true` and provide the necessary
connection details for your RDS instance.** Here is an example of how you can
configure your `docker-compose` file:
```yaml
version: '3.7'
services:
devlake:
image: apache/devlake:latest
environment:
- ENCRYPTION_SECRET=${ENCRYPTION_SECRET}
-
DB_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True
ports:
- "32001:8080"
depends_on:
- mysql
networks:
default:
external:
name: my-pre-existing-network
```
Replace the environment variables (`MYSQL_USER`, `MYSQL_PASSWORD`,
`MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_DATABASE`, and `ENCRYPTION_SECRET`) with the
actual values for your RDS instance.
2. **Comment out the 'mysql' part in `docker-compose.yml`:**
```yaml
# mysql:
# image: mysql:8
# volumes:
# - mysql-storage:/var/lib/mysql
# restart: always
# ports:
# - "127.0.0.1:3306:3306"
# environment:
# MYSQL_ROOT_PASSWORD: admin
# MYSQL_DATABASE: lake
# MYSQL_USER: merico
# MYSQL_PASSWORD: merico
# command:
# --character-set-server=utf8mb4
# --collation-server=utf8mb4_bin
```
3. **Comment out the 'mysql' volume in `docker-compose.yml`:**
```yaml
#volumes:
# mysql-storage:
```
4. **Comment out the 'depends_on mysql' part in `docker-compose.yml`:**
```yaml
# depends_on:
# - mysql
```
5. **Provide your managed cloud database connection info in the 'grafana'
section in `docker-compose.yml`:**
```yaml
MYSQL_URL: 123.45.67.89:3306
MYSQL_DATABASE: mydatabase
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
```
6. **Set `DB_URL` to your own DB_URL in `.env`:**
```bash
DB_URL="mysql://YOUR_USER:YOUR_PASSWORD@YOUR_IP:YOUR_PORT/lake?charset=utf8mb4&parseTime=True"
# Don't forget to create db named `lake` in your own db, and set
character-set-server=utf8mb4, collation-server=utf8mb4_bin as below
# character-set-server=utf8mb4
# collation-server=utf8mb4_bin
```
7. **Final step: `docker compose up -d`**
This will configure DevLake to use your MySQL RDS instance as its database.
For more detailed instructions, you can refer to the [official
documentation](https://github.com/apache/incubator-devlake/releases)
<sup>[[1]](https://github.com/apache/incubator-devlake-website/blob/main/docs/GettingStarted/HelmSetup.md)</sup><sup>[[2]](https://github.com/apache/incubator-devlake-website/blob/main/versioned_docs/version-v0.15/GettingStarted/HelmSetup.md)</sup><sup>[[3]](https://github.com/apache/incubator-devlake-website/blob/main/versioned_docs/version-v1.0/GettingStarted/HelmSetup.md)</sup><sup>[[4]](https://github.com/apache/incubator-devlake-website/blob/main/versioned_docs/version-v0.15/GettingStarted/DockerComposeSetup.md)</sup><sup>[[5]](https://github.com/apache/incubator-devlake-website/blob/main/docs/GettingStarted/DockerComposeSetup.md)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]