Skip to content

docker installation

Benjamin Jonard edited this page Dec 13, 2023 · 3 revisions

Using Docker (recommended)

See Configuration section for details on the different configuration options available and their values.

Step 1 -> Create a docker-compose.yml file

version: '3'

services:
    # Koillection
    koillection:
        image: koillection/koillection
        container_name: koillection
        restart: unless-stopped
        ports:
            - 80:80
        env_file:
            - .env
        depends_on:
            - db
        volumes:
            - ./volumes/koillection/uploads:/uploads

    # Database : choose one of the following
    db:
        image: postgres:16
        container_name: db
        restart: unless-stopped
        env_file:
            - .env
        environment:
            - POSTGRES_DB=${DB_NAME}
            - POSTGRES_USER=${DB_USER}
            - POSTGRES_PASSWORD=${DB_PASSWORD}
        volumes:
            - "./volumes/postgresql:/var/lib/postgresql/data"

    #db:
    #    image: mysql:latest
    #    container_name: db       
    #    restart: unless-stopped 
    #    environment:
    #        - MYSQL_DATABASE=${DB_NAME}
    #        - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
    #    volumes:
    #        - "./docker/volumes/mysql:/var/lib/mysql"

Step 2 -> Create a .env file

########################################################################################################
#                                                WEB
#
# APP_DEBUG=1 displays detailed error message
#
# APP_SECRET is a random string used for security, you can use for example openssl rand -base64 21
# APP_SECRET is automatically generated when using Docker
#
# PHP_TZ, see possible values here https://www.w3schools.com/php/php_ref_timezones.asp
########################################################################################################

APP_DEBUG=0
APP_ENV=prod
#APP_SECRET=

HTTPS_ENABLED=1
UPLOAD_MAX_FILESIZE=20M
PHP_MEMORY_LIMIT=512M
PHP_TZ=Europe/Paris


########################################################################################################
#                                                API
#
#
# JWT_PASSPHRASE is a random string used for security, you can use for example openssl rand -base64 21
# JWT_PASSPHRASE is automatically generated when using Docker
########################################################################################################

CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
#JWT_PASSPHRASE=

########################################################################################################
#                                                DATABASE
########################################################################################################

DB_DRIVER=pdo_pgsql
DB_NAME=koillection
DB_HOST=db
DB_PORT=5432
DB_USER=koillection
DB_PASSWORD=change_me!
DB_VERSION=16

Step 3 -> Review both files and update values if required

Step 4 -> Start Koillection

docker-compose up -d