diff --git a/readme-vars.yml b/readme-vars.yml index 1e3de78..82f433d 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -16,7 +16,7 @@ common_param_env_vars_enabled: true param_container_name: "{{ project_name }}" param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Persistent config files" } + - {vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Persistent config files"} - {vol_path: "/data", vol_host_path: "/path/to/data", desc: "Where Wiki.js data is stored."} param_usage_include_ports: true param_ports: @@ -30,6 +30,9 @@ opt_param_env_vars: - {env_var: "DB_NAME", env_value: "", desc: "DB name (postgres only)"} - {env_var: "DB_USER", env_value: "", desc: "DB username (postgres only)"} - {env_var: "DB_PASS", env_value: "", desc: "DB password (postgres only)"} + +readonly_supported: true + # application setup block app_setup_block_enabled: true app_setup_block: | diff --git a/root/defaults/config.yml b/root/defaults/config.yml index 47cdb88..0fc7ebf 100644 --- a/root/defaults/config.yml +++ b/root/defaults/config.yml @@ -21,14 +21,14 @@ port: 3000 # - sqlite = SQLite 3.9 or later db: - type: {{DB_TYPE}} + type: $(DB_TYPE) # PostgreSQL / MySQL / MariaDB / MS SQL Server only: - host: {{DB_HOST}} - port: {{DB_PORT}} - user: {{DB_USER}} - pass: {{DB_PASS}} - db: {{DB_NAME}} + host: '$(DB_HOST)' + port: $(DB_PORT) + user: '$(DB_USER)' + pass: '$(DB_PASS)' + db: $(DB_NAME) ssl: false # Optional - PostgreSQL / MySQL / MariaDB only: diff --git a/root/etc/s6-overlay/s6-rc.d/init-wikijs-config/run b/root/etc/s6-overlay/s6-rc.d/init-wikijs-config/run index 14d2899..d897f67 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-wikijs-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-wikijs-config/run @@ -1,31 +1,19 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -mkdir -p /data - -DB_TYPE=${DB_TYPE:-sqlite} -DB_HOST=${DB_HOST:-mariadb} -DB_PORT=${DB_PORT:-3306} -DB_USER=${DB_USER:-root} -DB_PASS=${DB_PASS:-root} -DB_NAME=${DB_NAME:-wikijs} +if [[ -z ${DB_TYPE} ]]; then + printf "sqlite" > /run/s6/container_environment/DB_TYPE +fi if [[ ! -f "/config/config.yml" ]]; then cp /defaults/config.yml /config/config.yml - - sed -i "s|{{DB_TYPE}}|"${DB_TYPE}"|g" /config/config.yml - sed -i "s|{{DB_HOST}}|"${DB_HOST}"|g" /config/config.yml - sed -i "s|{{DB_PORT}}|"${DB_PORT}"|g" /config/config.yml - sed -i "s|{{DB_USER}}|"${DB_USER}"|g" /config/config.yml - sed -i "s|{{DB_PASS}}|"${DB_PASS}"|g" /config/config.yml - sed -i "s|{{DB_NAME}}|"${DB_NAME}"|g" /config/config.yml fi -ln -sf /config/config.yml /app/wiki/config.yml - # permissions lsiown -R abc:abc \ - /app/wiki/data \ /config -lsiown abc:abc \ - /data + +if grep -qe ' /data ' /proc/mounts; then + lsiown abc:abc \ + /data +fi diff --git a/root/etc/s6-overlay/s6-rc.d/svc-wikijs/run b/root/etc/s6-overlay/s6-rc.d/svc-wikijs/run index a968f73..db6831a 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-wikijs/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-wikijs/run @@ -1,6 +1,8 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash +export CONFIG_FILE="/config/config.yml" + exec \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 3000" \ cd /app/wiki s6-setuidgid abc /usr/bin/node server