How to clean the n8n since the disk is full

Hello!
the disk in my VPS is almost full and I’m trying to clean it.

Here is my docker-compose.yml:

version: "3"

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}N8N_BASIC_AUTH_ACTIVE
      - EXECUTIONS_DATA_SAVE_ON_ERROR=all
      - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
      - EXECUTIONS_DATA_SAVE_ON_PROGRESS=true
      - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
      - EXECUTIONS_DATA_PRUNE=true
      - EXECUTIONS_DATA_MAX_AGE=90
      - DB_SQLITE_VACUUM_ON_STARTUP=true
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
      - /local-files:/files

I restarted the server several times, the size of the disk does not decrease.
I install n8n by default docker. Database is SQLite or not, I don’t remember - how do I determine that?
I’m not very knowledgeable about console, could you please tell me what I need to do?
Honestly, I’m afraid to run commands in the console, I’m afraid to do harm and the server will stop working.

How can I Vacuum my SQLite database?

Thank you so much in advance!

Hey,

Could you try to add this:

        - EXECUTIONS_DATA_PRUNE_TIMEOUT=604800

The 604800 is 7 days in seconds, you can change it if you wish.

Then restart container (two times if first will do nothing). LMK if that help

This is my docker-compose if helpful:

version: "3"

services:
  n8n:
      image: n8nio/n8n:latest
      container_name: n8n
      restart: always
      ports:
        - "5678:${PORT}"
      environment:
        - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
        - N8N_PORT=${PORT}
        - N8N_PROTOCOL=https
        - NODE_ENV=production
        - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
        - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
        - NODE_FUNCTION_ALLOW_EXTERNAL=moment,date-utils
        - N8N_USER_MANAGEMENT_DISABLED=${N8N_USER_MANAGEMENT_DISABLED}
        - N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
        - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
        - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
        - N8N_BASIC_AUTH_HASH=${N8N_BASIC_AUTH_HASH}
        - EXECUTIONS_DATA_PRUNE=true
        - EXECUTIONS_DATA_PRUNE_TIMEOUT=604800
        - DB_SQLITE_VACUUM_ON_STARTUP=true
        - EXECUTIONS_DATA_MAX_AGE=7
      volumes:
        - ./.n8n:/home/node/.n8n
        - ./n8n-local-files:/files
      networks:
        - nginx
          
networks:
  nginx:
    external:
      name: nginx
1 Like

Thank you @Shirobachi for the quick response!

I add " - EXECUTIONS_DATA_PRUNE_TIMEOUT=604800" to my docker-compose.yml

then I ran the commands twice:
docker-compose down
docker-compose up -d

The size has not changed at all. :slightly_frowning_face:

Would you mind run docker-compose up without -d and paste here logs?

1 Like

Also change the value to something smaller like 1000 and login server and check how big is database file it will be is data folder/.n8n something like database.sqlite

1 Like

5958putty_portable

I have database.sqlite = 69.4 MB

5960chrome

I expected more lines TBH, did you want for full start?
Also, 70MB is not that much, I do not know how many things do you have but if you have many WFs, creds etc. this might be just that size, is it possible?

1 Like

I made “- EXECUTIONS_DATA_PRUNE_TIMEOUT=1000”

then I ran the commands twice:
docker-compose down
docker-compose up -d

The size has not changed at all.

Now I have total size - 8,88 GB - it’s too much as seems to me.

8 GB is too much of course but database you say is only 70 MB what files take that much?

Where is docker-compose.yml and what is set for env DATA_FOLDER?

1 Like

volumes:
- ${DATA_FOLDER}/.n8n:/home/node/.n8n
- /local-files:/files

It’s Empty.

The screen where you show that /lib is so heavy is from your host or container?

1 Like

Yes, that folder weighs so much. I don’t know what’s in it and why it weighs so much.

I think it is NOT from my host.

Yes, but it is inside the container, or it’s on your server (host)?

1 Like

5965chrome

That’s weird, but not sure why… try this:
docker system prune -a

2 Likes

Still 6GB left instrestting

1 Like