How can you use kickstart with docker



  • I want to use kickstart with my docker container for easy dev envt setup. How can I do so?



  • You need to mount a directory containing your kickstart file and then set the FUSIONAUTH_KICKSTART environment variable.

    • Create a local directory, which will eventually get mounted in the container (./kickstart)
    • Put the kickstart config in there
    • Tell docker-compose to mount that as a volume in the container. Now the kickstart config will be in the container.
    • In the volumes: section of the fusionauth service, add - ./kickstart:/usr/local/fusionauth/kickstart
    • Modify .env and add the kickstart config variable line: FUSIONAUTH_KICKSTART=/usr/local/fusionauth/kickstart/fa-kickstart.json
    • Tell docker-compose to pass that into the container as an env var. In the environment section of the fusionauth service, add FUSIONAUTH_KICKSTART: ${FUSIONAUTH_KICKSTART}

    Here's a sample docker compose which uses the kickstart.json file in the current directory:

    version: '3'
    
    services:
      db:
        image: postgres:9.6
        environment:
          PGDATA: /var/lib/postgresql/data/pgdata
          POSTGRES_USER: ${POSTGRES_USER}
          POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    # Un-comment to access the db service directly
    #    ports:
    #      - 5432:5432
        networks:
          - db
        restart: unless-stopped
        volumes:
          - db_data:/var/lib/postgresql/data
    
      fusionauth:
        image: fusionauth/fusionauth-app:latest
        depends_on:
          - db
        environment:
          DATABASE_URL: jdbc:postgresql://db:5432/fusionauth
          DATABASE_ROOT_USER: ${POSTGRES_USER}
          DATABASE_ROOT_PASSWORD: ${POSTGRES_PASSWORD}
          DATABASE_USER: ${DATABASE_USER}
          DATABASE_PASSWORD: ${DATABASE_PASSWORD}
          FUSIONAUTH_MEMORY: ${FUSIONAUTH_MEMORY}
          FUSIONAUTH_SEARCH_ENGINE_TYPE: database
          FUSIONAUTH_URL: http://fusionauth:9011
          FUSIONAUTH_RUNTIME_MODE: development
          FUSIONAUTH_KICKSTART: ${FUSIONAUTH_KICKSTART}
        networks:
         - db
        restart: unless-stopped
        ports:
          - 9011:9011
        volumes:
          - fa_config:/usr/local/fusionauth/config
          - ./kickstart:/usr/local/fusionauth/kickstart
    
    networks:
      db:
        driver: bridge
    
    volumes:
      db_data:
      fa_config:
    

Log in to reply