Skip to content

Commit

Permalink
Use sqlite because of MySQL issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench authored Jul 10, 2023
1 parent 27dfb29 commit c2e5074
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,20 @@ Change the environment variable `GENERIC_TIMEZONE` to your timezone.

### Database

The n8n service uses the existing DDEV MySQL server. The `n8n/startup-script.sh` creates a new database named `n8n` during startup of the container.
#### Standard SQLite

Currently **only mysql** is supported by the ddev add-on.
The n8n service uses the standard SQLite database.
The SQLite database file will be created as file `.ddev/n8n/database.sqlite` during the n8n container startup.

#### MySQL

We deliver the startup scripts to use the existing DDEV MySQL server (if configured).
The `n8n/startup-script.sh` creates a new database named `n8n` during startup of the container.

To use MySQL you have to uncomment some configurations in the docker-compose.n8n.yaml file.

Please note that the **mysql support was depprecated** by n8n.
It is recommended to use Postgres. The latest n8n version had also startup issues in the ddev setup.

## Logging

Expand Down
20 changes: 12 additions & 8 deletions docker-compose.n8n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ services:
build:
context: ./n8n/
dockerfile: Dockerfile
command: ["/bin/sh", "/startup-script.sh"]
# only for mysql
#command: ["/bin/sh", "/startup-script.sh"]
networks: [default, ddev_default]
labels:
com.ddev.site-name: ${DDEV_SITENAME}
Expand All @@ -20,7 +21,8 @@ services:
- db
volumes:
- ".:/mnt/ddev_config"
- "./n8n/startup-script.sh:/startup-script.sh"
# only for mysql
#- "./n8n/startup-script.sh:/startup-script.sh"
environment:
GENERIC_TIMEZONE: "Europe/Berlin"
N8N_BASIC_AUTH_ACTIVE: false
Expand All @@ -29,13 +31,15 @@ services:
N8N_HOST: "${DDEV_SITENAME}.ddev.site"
N8N_PORT: 5678
N8N_PROTOCOL: http
#N8N_LOG_LEVEL: debug
N8N_LOG_OUTPUT: "stdout"
VIRTUAL_HOST: "$DDEV_HOSTNAME"
DB_TYPE: mysqldb
DB_MYSQLDB_HOST: db
DB_MYSQLDB_PORT: 3306
DB_MYSQLDB_USER: db
DB_MYSQLDB_PASSWORD: db
DB_MYSQLDB_DATABASE: n8n
DB_SQLITE_DB_FILE: "/mnt/ddev_config/n8n/database.sqlite"
#DB_TYPE: mysqldb
#DB_MYSQLDB_HOST: db
#DB_MYSQLDB_PORT: 3306
#DB_MYSQLDB_USER: db
#DB_MYSQLDB_PASSWORD: db
#DB_MYSQLDB_DATABASE: n8n
HTTP_EXPOSE: "5678:5678"
HTTPS_EXPOSE: "5679:5678"
4 changes: 2 additions & 2 deletions n8n/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use the n8nio/n8n image as base
FROM n8nio/n8n:latest
FROM docker.n8n.io/n8nio/n8n:latest

# Install the MySQL client
RUN apk add --no-cache mysql-client
RUN apk add --no-cache bash mysql-client

# Download wait-for-it
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /wait-for-it.sh && \
Expand Down
2 changes: 1 addition & 1 deletion n8n/startup-script.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
set -ex

echo "Waiting for MySQL to be ready ..."
# Use wait-for-it to wait for MySQL to be ready
Expand Down

0 comments on commit c2e5074

Please sign in to comment.