Hi! i am running postgres and kratos in dev mode u...
# talk-kratos
e
Hi! i am running postgres and kratos in dev mode using docker, it is using the official kratos self service ui node to render the login and sign up page. Everything works fine but when i remove the containers using
docker-compose down
i am unable to persist any users that did sign up even though the postgres has a volume attached. Strange thing is the migrations are being persistent because when i run them it shows migrations already available in the logs i am adding my docker-compose and env file below so please have a look.
Copy code
# docker-compose.yml
version: "3.9"
services:
  postgres-billboard:
    image: postgres:9.6-alpine
    restart: always
    hostname: kratos-database-billboard
    container_name: kratos-database-billboard
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres-data-kratos:/var/lib/postgresql/data
    ports:
      - "${POSTGRES_EXPOSE_PORT}:5432"

  kratos-migrate-billboard:
    image: oryd/kratos:v0.10.1
    hostname: kratos-migrate-billboard
    container_name: kratos-migrate-billboard
    depends_on:
      - postgres-billboard
    environment:
      - DNS=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@kratos-database-billboard:5432/${POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
    volumes:
      - ./kratos:/etc/config/kratos
    command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
    restart: on-failure

  kratos-billboard:
    image: oryd/kratos:v0.10.1
    hostname: kratos-billboard
    container_name: kratos-billboard
    depends_on:
      - kratos-migrate-billboard
    environment:
      - DNS=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@kratos-database-billboard:5432/${POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
    ports:
      - ${KRATOS_EXPOSE_PORT}:4433
      - ${KRATOS_ADMIN_EXPOSE_PORT}:4434
    volumes:
      - ./kratos:/etc/config/kratos
    command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
    restart: unless-stopped

  kratos-selfservice-ui-node-billboard:
    image: oryd/kratos-selfservice-ui-node:v0.10.1
    hostname: kratos-selfservice-ui-node-billboard
    container_name: kratos-selfservice-ui-node-billboard
    depends_on:
      - kratos-migrate-billboard
    environment:
      - KRATOS_PUBLIC_URL=<http://kratos-billboard:4433/|http://kratos-billboard:4433/>
      - KRATOS_BROWSER_URL=<http://127.0.0.1:${KRATOS_EXPOSE_PORT}/|http://127.0.0.1:${KRATOS_EXPOSE_PORT}/>
    ports:
      - ${KRATOS_UI_EXPOSE_PORT}:3000
    restart: on-failure

volumes:
  postgres-data-kratos:
  kratos:

networks:
  default:
    name: kratos-billboard-net
Copy code
# .env
POSTGRES_USER=kraots-billboard
POSTGRES_DB=kratos
POSTGRES_PASSWORD=loremipsumdolor
POSTGRES_EXPOSE_PORT=3432

KRATOS_EXPOSE_PORT=3433
KRATOS_ADMIN_EXPOSE_PORT=3434

KRATOS_UI_EXPOSE_PORT=3000

LOCAL_HOST=172.17.0.1
commands to run
Copy code
docker-compose up -d
command to turn off
Copy code
docker-compose down
i thought i had issue while setting up the volume but that wasn't the case