Drone

Unable to persist database to host

Hi, I am using the following pipeline and although it completes successfully nothing is persisted to the host server:

kind: pipeline
name: default

steps:
  - name: install-dependencies
    image: node:10
    volumes:
      - name: shared
        path: /tmp/shared
    commands:
      - npm install
  - name: run-migrations
    image: node:10
    volumes:
      - name: shared
        path: /tmp/shared
    environment:
      ACTIVE_DB: 'DEV_LOCAL_DB_HOST'
      DEV_LOCAL_DB_HOST: '...'
      DEV_LOCAL_DB_USER: '...'
      DEV_LOCAL_DB_PASSWORD: '...'
      DEV_LOCAL_DB_NAME: '...'
    commands:
      - sleep 30
      - npm run db-migrations:up
      - echo 'db-migrations finished!'

services:
  - name: db
    image: "mysql:8.0"
    command: [ --default-authentication-plugin=mysql_native_password ]
    restart: always
    environment:
      DATABASE_HOST: 'db'
      MYSQL_DATABASE: 'smsservice'
      MYSQL_USER: '...'
      MYSQL_PASSWORD: '...'
      MYSQL_ROOT_PASSWORD: '...'
    ports:
      - 3306
    volumes:
      - name: db-persist
        path: /opt

volumes:
  - name: db-persist
    host:
      path: /Volumes
  - name: shared
    temp: {}

Any ideas? Is there something wrong with my volumes definition?

Hi

Did you ever find an answer to this?

I’m trying to persist the database too, but couldn’t find any information on the subject. I think it might not be possible with a ‘service’.