From a9960fd5596005e5cb02cadd595b1b9fceebcc12 Mon Sep 17 00:00:00 2001 From: thespad Date: Fri, 31 May 2024 14:19:58 +0100 Subject: [PATCH 1/4] Rebase to 3.20 --- Dockerfile | 46 +++++++--------- Dockerfile.aarch64 | 46 +++++++--------- Jenkinsfile | 4 +- README.md | 52 ++++++++++--------- jenkins-vars.yml | 4 +- readme-vars.yml | 20 +++---- .../nginx/site-confs/default.conf.sample | 9 ++-- root/etc/crontabs/abc | 2 +- root/etc/crontabs/root | 6 --- .../{php81 => php83}/conf.d/snipe-local.ini | 0 .../s6-rc.d/init-snipe-it-config/run | 8 +-- .../svc-php-fpm/dependencies.d/init-services | 0 root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run | 6 --- root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type | 1 - 14 files changed, 90 insertions(+), 114 deletions(-) delete mode 100644 root/etc/crontabs/root rename root/etc/{php81 => php83}/conf.d/snipe-local.ini (100%) delete mode 100644 root/etc/s6-overlay/s6-rc.d/svc-php-fpm/dependencies.d/init-services delete mode 100755 root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type diff --git a/Dockerfile b/Dockerfile index 2e18e60a..6302e0f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.17 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.20 # set version label ARG BUILD_DATE @@ -10,35 +10,26 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="TheLamer" RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ libxml2 \ mariadb-client \ - php81-bcmath \ - php81-ctype \ - php81-curl \ - php81-exif \ - php81-gd \ - php81-iconv \ - php81-ldap \ - php81-pdo_mysql \ - php81-pdo_sqlite \ - php81-pecl-redis \ - php81-phar \ - php81-sodium \ - php81-sqlite3 \ - php81-tokenizer \ - php81-xmlreader \ - php81-zip && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php81-pecl-mcrypt && \ + php83-bcmath \ + php83-exif \ + php83-gd \ + php83-ldap \ + php83-pdo_mysql \ + php83-pdo_sqlite \ + php83-pecl-redis \ + php83-sodium \ + php83-sqlite3 \ + php83-tokenizer \ + php83-xmlreader \ + php83-pecl-mcrypt && \ echo "**** configure php-fpm to pass env vars ****" && \ - sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \ - grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \ - echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php83/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php83/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php83/php-fpm.d/www.conf && \ + echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php83/php-fpm.conf && \ echo "**** install snipe-it ****" && \ mkdir -p \ /app/www/ && \ @@ -59,10 +50,10 @@ RUN \ "/app/www/storage" \ "/app/www/public/uploads" \ /defaults/ && \ + printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ rm -rf \ + $HOME/.cache \ $HOME/.composer \ /tmp/* @@ -71,4 +62,5 @@ COPY root/ / # ports and volumes EXPOSE 80 443 + VOLUME /config diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 0fcd6a49..79868c06 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.17 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.20 # set version label ARG BUILD_DATE @@ -10,35 +10,26 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="TheLamer" RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ libxml2 \ mariadb-client \ - php81-bcmath \ - php81-ctype \ - php81-curl \ - php81-exif \ - php81-gd \ - php81-iconv \ - php81-ldap \ - php81-pdo_mysql \ - php81-pdo_sqlite \ - php81-pecl-redis \ - php81-phar \ - php81-sodium \ - php81-sqlite3 \ - php81-tokenizer \ - php81-xmlreader \ - php81-zip && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php81-pecl-mcrypt && \ + php83-bcmath \ + php83-exif \ + php83-gd \ + php83-ldap \ + php83-pdo_mysql \ + php83-pdo_sqlite \ + php83-pecl-redis \ + php83-sodium \ + php83-sqlite3 \ + php83-tokenizer \ + php83-xmlreader \ + php83-pecl-mcrypt && \ echo "**** configure php-fpm to pass env vars ****" && \ - sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \ - grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \ - echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php83/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php83/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php83/php-fpm.d/www.conf && \ + echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php83/php-fpm.conf && \ echo "**** install snipe-it ****" && \ mkdir -p \ /app/www/ && \ @@ -59,10 +50,10 @@ RUN \ "/app/www/storage" \ "/app/www/public/uploads" \ /defaults/ && \ + printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ rm -rf \ + $HOME/.cache \ $HOME/.composer \ /tmp/* @@ -71,4 +62,5 @@ COPY root/ / # ports and volumes EXPOSE 80 443 + VOLUME /config diff --git a/Jenkinsfile b/Jenkinsfile index 06e49c8a..706c3c49 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,9 +33,9 @@ pipeline { CI_WEB='false' CI_PORT='80' CI_SSL='false' - CI_DELAY='120' + CI_DELAY='60' CI_DOCKERENV='APP_URL=http://localhost:80|NGINX_APP_URL=_|DB_CONNECTION=sqlite_testing' - CI_AUTH='user:password' + CI_AUTH='' CI_WEBPATH='' } stages { diff --git a/README.md b/README.md index 716ec3c1..541bf5ac 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Find us at: [Snipe-it](https://github.com/snipe/snipe-it) makes asset management easy. It was built by people solving real-world IT and asset management problems, and a solid UX has always been a top priority. Straightforward design and bulk actions mean getting things done faster. -[![snipe-it](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/snipe-it-logo500x500.png)](https://github.com/snipe/snipe-it) +[![snipe-it](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/snipe-it-logo.png)](https://github.com/snipe/snipe-it) ## Supported Architectures @@ -90,17 +90,18 @@ services: - MYSQL_USER= - MYSQL_PASSWORD= - APP_ENV=production #optional + - APP_KEY= #optional - APP_DEBUG=false #optional - APP_LOCALE= #optional - - MAIL_PORT_587_TCP_ADDR=US/Pacific #optional - - MAIL_PORT_587_TCP_PORT=US/Pacific #optional - - MAIL_ENV_FROM_ADDR=US/Pacific #optional - - MAIL_ENV_FROM_NAME=US/Pacific #optional - - MAIL_ENV_ENCRYPTION=US/Pacific #optional - - MAIL_ENV_USERNAME=US/Pacific #optional - - MAIL_ENV_PASSWORD=US/Pacific #optional + - MAIL_PORT_587_TCP_ADDR= #optional + - MAIL_PORT_587_TCP_PORT= #optional + - MAIL_ENV_FROM_ADDR= #optional + - MAIL_ENV_FROM_NAME= #optional + - MAIL_ENV_ENCRYPTION= #optional + - MAIL_ENV_USERNAME= #optional + - MAIL_ENV_PASSWORD= #optional volumes: - - /path/to/data:/config + - /path/to/snipe-it/data:/config ports: - 8080:80 restart: unless-stopped @@ -121,17 +122,18 @@ docker run -d \ -e MYSQL_USER= \ -e MYSQL_PASSWORD= \ -e APP_ENV=production `#optional` \ + -e APP_KEY= `#optional` \ -e APP_DEBUG=false `#optional` \ -e APP_LOCALE= `#optional` \ - -e MAIL_PORT_587_TCP_ADDR=US/Pacific `#optional` \ - -e MAIL_PORT_587_TCP_PORT=US/Pacific `#optional` \ - -e MAIL_ENV_FROM_ADDR=US/Pacific `#optional` \ - -e MAIL_ENV_FROM_NAME=US/Pacific `#optional` \ - -e MAIL_ENV_ENCRYPTION=US/Pacific `#optional` \ - -e MAIL_ENV_USERNAME=US/Pacific `#optional` \ - -e MAIL_ENV_PASSWORD=US/Pacific `#optional` \ + -e MAIL_PORT_587_TCP_ADDR= `#optional` \ + -e MAIL_PORT_587_TCP_PORT= `#optional` \ + -e MAIL_ENV_FROM_ADDR= `#optional` \ + -e MAIL_ENV_FROM_NAME= `#optional` \ + -e MAIL_ENV_ENCRYPTION= `#optional` \ + -e MAIL_ENV_USERNAME= `#optional` \ + -e MAIL_ENV_PASSWORD= `#optional` \ -p 8080:80 \ - -v /path/to/data:/config \ + -v /path/to/snipe-it/data:/config \ --restart unless-stopped \ lscr.io/linuxserver/snipe-it:latest ``` @@ -153,15 +155,16 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e MYSQL_USER=` | Mysql user to use | | `-e MYSQL_PASSWORD=` | Mysql password to use | | `-e APP_ENV=production` | Default is `production` but can use `testing` or `develop`. | +| `-e APP_KEY=` | App key used for encrypting stored data. Generate with `docker exec snipe-it php /app/www/artisan key:generate --show`. | | `-e APP_DEBUG=false` | Set to `true` to see debugging output in the web UI. | | `-e APP_LOCALE=` | Default is `en`. Set to a language from [this list](https://snipe-it.readme.io/docs/configuration#section-setting-a-language). | -| `-e MAIL_PORT_587_TCP_ADDR=US/Pacific` | SMTP mail server ip or hostname. | -| `-e MAIL_PORT_587_TCP_PORT=US/Pacific` | SMTP mail server port. | -| `-e MAIL_ENV_FROM_ADDR=US/Pacific` | The email address mail should be replied to and listed when sent. | -| `-e MAIL_ENV_FROM_NAME=US/Pacific` | The name listed on email sent from the default account on the system. | -| `-e MAIL_ENV_ENCRYPTION=US/Pacific` | Mail encryption to use e.g. `tls`. | -| `-e MAIL_ENV_USERNAME=US/Pacific` | SMTP server login username. | -| `-e MAIL_ENV_PASSWORD=US/Pacific` | SMTP server login password. | +| `-e MAIL_PORT_587_TCP_ADDR=` | SMTP mail server ip or hostname. | +| `-e MAIL_PORT_587_TCP_PORT=` | SMTP mail server port. | +| `-e MAIL_ENV_FROM_ADDR=` | The email address mail should be replied to and listed when sent. | +| `-e MAIL_ENV_FROM_NAME=` | The name listed on email sent from the default account on the system. | +| `-e MAIL_ENV_ENCRYPTION=` | Mail encryption to use e.g. `tls`. | +| `-e MAIL_ENV_USERNAME=` | SMTP server login username. | +| `-e MAIL_ENV_PASSWORD=` | SMTP server login password. | | `-v /config` | Contains your config files and data storage for Snipe-IT | ## Environment variables from files (Docker secrets) @@ -325,6 +328,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **31.05.24:** - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings. * **06.03.24:** - Existing users should update: site-confs/default.conf - Cleanup default site conf. * **17.02.24:** - Add php81-exif. * **03.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf) diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 56072edf..d2016df8 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -23,9 +23,9 @@ repo_vars: - CI_WEB='false' - CI_PORT='80' - CI_SSL='false' - - CI_DELAY='120' + - CI_DELAY='60' - CI_DOCKERENV='APP_URL=http://localhost:80|NGINX_APP_URL=_|DB_CONNECTION=sqlite_testing' - - CI_AUTH='user:password' + - CI_AUTH='' - CI_WEBPATH='' sponsor_links: - { name: "Snipe-IT", url: "https://snipeitapp.com/donate" } diff --git a/readme-vars.yml b/readme-vars.yml index 5fcd76dd..9e4e1ac2 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -3,7 +3,7 @@ # project information project_name: snipe-it project_url: "https://github.com/snipe/snipe-it" -project_logo: "https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/snipe-it-logo500x500.png" +project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/snipe-it-logo.png" project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) makes asset management easy. It was built by people solving real-world IT and asset management problems, and a solid UX has always been a top priority. Straightforward design and bulk actions mean getting things done faster." project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}" # supported architectures @@ -15,7 +15,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/data", desc: "Contains your config files and data storage for Snipe-IT"} + - {vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/data", desc: "Contains your config files and data storage for Snipe-IT"} param_usage_include_ports: true param_ports: - {external_port: "8080", internal_port: "80", port_desc: "Snipe-IT Web UI"} @@ -31,15 +31,16 @@ param_env_vars: opt_param_usage_include_env: true opt_param_env_vars: - {env_var: "APP_ENV", env_value: "production", desc: "Default is `production` but can use `testing` or `develop`."} + - {env_var: "APP_KEY", env_value: "", desc: "App key used for encrypting stored data. Generate with `docker exec snipe-it php /app/www/artisan key:generate --show`."} - {env_var: "APP_DEBUG", env_value: "false", desc: "Set to `true` to see debugging output in the web UI."} - {env_var: "APP_LOCALE", env_value: "", desc: "Default is `en`. Set to a language from [this list](https://snipe-it.readme.io/docs/configuration#section-setting-a-language)."} - - {env_var: "MAIL_PORT_587_TCP_ADDR", env_value: "US/Pacific", desc: "SMTP mail server ip or hostname."} - - {env_var: "MAIL_PORT_587_TCP_PORT", env_value: "US/Pacific", desc: "SMTP mail server port."} - - {env_var: "MAIL_ENV_FROM_ADDR", env_value: "US/Pacific", desc: "The email address mail should be replied to and listed when sent."} - - {env_var: "MAIL_ENV_FROM_NAME", env_value: "US/Pacific", desc: "The name listed on email sent from the default account on the system."} - - {env_var: "MAIL_ENV_ENCRYPTION", env_value: "US/Pacific", desc: "Mail encryption to use e.g. `tls`."} - - {env_var: "MAIL_ENV_USERNAME", env_value: "US/Pacific", desc: "SMTP server login username."} - - {env_var: "MAIL_ENV_PASSWORD", env_value: "US/Pacific", desc: "SMTP server login password."} + - {env_var: "MAIL_PORT_587_TCP_ADDR", env_value: "", desc: "SMTP mail server ip or hostname."} + - {env_var: "MAIL_PORT_587_TCP_PORT", env_value: "", desc: "SMTP mail server port."} + - {env_var: "MAIL_ENV_FROM_ADDR", env_value: "", desc: "The email address mail should be replied to and listed when sent."} + - {env_var: "MAIL_ENV_FROM_NAME", env_value: "", desc: "The name listed on email sent from the default account on the system."} + - {env_var: "MAIL_ENV_ENCRYPTION", env_value: "", desc: "Mail encryption to use e.g. `tls`."} + - {env_var: "MAIL_ENV_USERNAME", env_value: "", desc: "SMTP server login username."} + - {env_var: "MAIL_ENV_PASSWORD", env_value: "", desc: "SMTP server login password."} # application setup block app_setup_block_enabled: true app_setup_block: | @@ -53,6 +54,7 @@ app_setup_block: | # changelog changelogs: + - {date: "31.05.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings."} - {date: "06.03.24:", desc: "Existing users should update: site-confs/default.conf - Cleanup default site conf."} - {date: "17.02.24:", desc: "Add php81-exif."} - {date: "03.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"} diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 38f927f5..774da186 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -1,11 +1,8 @@ -## Version 2024/03/06 - Changelog: https://github.com/linuxserver/docker-snapdrop/commits/master/root/defaults/nginx/site-confs/default.conf.sample +## Version 2024/05/31 - Changelog: https://github.com/linuxserver/docker-snapdrop/commits/master/root/defaults/nginx/site-confs/default.conf.sample server { - listen 80 default_server; - listen [::]:80 default_server; - - listen 443 ssl http2 default_server; - listen [::]:443 ssl http2 default_server; + listen *:80 default_server; + listen *:443 ssl default_server; server_name APP_URL_PLACEHOLDER; diff --git a/root/etc/crontabs/abc b/root/etc/crontabs/abc index 2a2a8373..c14c5ff4 100644 --- a/root/etc/crontabs/abc +++ b/root/etc/crontabs/abc @@ -1,2 +1,2 @@ # min hour day month weekday command -* * * * * php /app/www/artisan schedule:run >> /dev/null 2>&1 +* * * * * /usr/bin/php /app/www/artisan schedule:run 2>&1 diff --git a/root/etc/crontabs/root b/root/etc/crontabs/root deleted file mode 100644 index f35d7bca..00000000 --- a/root/etc/crontabs/root +++ /dev/null @@ -1,6 +0,0 @@ -# min hour day month weekday command -*/15 * * * * run-parts /etc/periodic/15min -0 * * * * run-parts /etc/periodic/hourly -0 2 * * * run-parts /etc/periodic/daily -0 3 * * 6 run-parts /etc/periodic/weekly -0 5 1 * * run-parts /etc/periodic/monthly diff --git a/root/etc/php81/conf.d/snipe-local.ini b/root/etc/php83/conf.d/snipe-local.ini similarity index 100% rename from root/etc/php81/conf.d/snipe-local.ini rename to root/etc/php83/conf.d/snipe-local.ini diff --git a/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run b/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run index 30b39c1f..30e4b193 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run @@ -35,11 +35,13 @@ if [[ ! -L /app/www/public/uploads ]]; then fi # Create API key if needed -if [[ ! -f "/config/SNIPE_IT_APP_KEY.txt" ]]; then +if [[ ! -f "/config/SNIPE_IT_APP_KEY.txt" ]] && [[ -z "${APP_KEY}" ]]; then echo "Generating SnipeIT app key for first run" key=$(php /app/www/artisan key:generate --show) - echo "${key}" >/config/SNIPE_IT_APP_KEY.txt - echo "App Key set to ${key} you can modify the file to update /config/SNIPE_IT_APP_KEY.txt" + printf "%s" "${key}" > /run/s6/container_environment/APP_KEY + echo "App Key set to ${key} you can set the APP_KEY environment variable to override" +elif [[ -f "/config/SNIPE_IT_APP_KEY.txt" ]]; then + printf '%s' "$(cat /config/SNIPE_IT_APP_KEY.txt)" > /run/s6/container_environment/APP_KEY fi # permissions diff --git a/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/dependencies.d/init-services deleted file mode 100644 index e69de29b..00000000 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run b/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run deleted file mode 100755 index 9e7175ca..00000000 --- a/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -export APP_KEY=$(cat /config/SNIPE_IT_APP_KEY.txt) - -exec /usr/sbin/php-fpm81 -F diff --git a/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type b/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type deleted file mode 100644 index 5883cff0..00000000 --- a/root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type +++ /dev/null @@ -1 +0,0 @@ -longrun From c14d6578e82e39945cf5c38050f94ee72a7c5f79 Mon Sep 17 00:00:00 2001 From: thespad Date: Fri, 31 May 2024 14:23:10 +0100 Subject: [PATCH 2/4] Adjust app key handling --- README.md | 6 +++--- readme-vars.yml | 2 +- root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 541bf5ac..5e1c128c 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ services: - PUID=1000 - PGID=1000 - TZ=Etc/UTC + - APP_KEY= - APP_URL=http://localhost:8080 - MYSQL_PORT_3306_TCP_ADDR= - MYSQL_PORT_3306_TCP_PORT= @@ -90,7 +91,6 @@ services: - MYSQL_USER= - MYSQL_PASSWORD= - APP_ENV=production #optional - - APP_KEY= #optional - APP_DEBUG=false #optional - APP_LOCALE= #optional - MAIL_PORT_587_TCP_ADDR= #optional @@ -115,6 +115,7 @@ docker run -d \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ + -e APP_KEY= \ -e APP_URL=http://localhost:8080 \ -e MYSQL_PORT_3306_TCP_ADDR= \ -e MYSQL_PORT_3306_TCP_PORT= \ @@ -122,7 +123,6 @@ docker run -d \ -e MYSQL_USER= \ -e MYSQL_PASSWORD= \ -e APP_ENV=production `#optional` \ - -e APP_KEY= `#optional` \ -e APP_DEBUG=false `#optional` \ -e APP_LOCALE= `#optional` \ -e MAIL_PORT_587_TCP_ADDR= `#optional` \ @@ -148,6 +148,7 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e PUID=1000` | for UserID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | +| `-e APP_KEY=` | App key used for encrypting stored data. Generate with `docker exec snipe-it php /app/www/artisan key:generate --show`. | | `-e APP_URL=http://localhost:8080` | Hostname or IP and port if applicable, be sure to define https/http | | `-e MYSQL_PORT_3306_TCP_ADDR=` | Mysql hostname or IP to use | | `-e MYSQL_PORT_3306_TCP_PORT=` | Mysql port to use | @@ -155,7 +156,6 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e MYSQL_USER=` | Mysql user to use | | `-e MYSQL_PASSWORD=` | Mysql password to use | | `-e APP_ENV=production` | Default is `production` but can use `testing` or `develop`. | -| `-e APP_KEY=` | App key used for encrypting stored data. Generate with `docker exec snipe-it php /app/www/artisan key:generate --show`. | | `-e APP_DEBUG=false` | Set to `true` to see debugging output in the web UI. | | `-e APP_LOCALE=` | Default is `en`. Set to a language from [this list](https://snipe-it.readme.io/docs/configuration#section-setting-a-language). | | `-e MAIL_PORT_587_TCP_ADDR=` | SMTP mail server ip or hostname. | diff --git a/readme-vars.yml b/readme-vars.yml index 9e4e1ac2..72b489b2 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -21,6 +21,7 @@ param_ports: - {external_port: "8080", internal_port: "80", port_desc: "Snipe-IT Web UI"} param_usage_include_env: true param_env_vars: + - {env_var: "APP_KEY", env_value: "", desc: "App key used for encrypting stored data. Generate with `docker exec snipe-it php /app/www/artisan key:generate --show`."} - {env_var: "APP_URL", env_value: "http://localhost:8080", desc: "Hostname or IP and port if applicable, be sure to define https/http"} - {env_var: "MYSQL_PORT_3306_TCP_ADDR", env_value: "", desc: "Mysql hostname or IP to use"} - {env_var: "MYSQL_PORT_3306_TCP_PORT", env_value: "", desc: "Mysql port to use"} @@ -31,7 +32,6 @@ param_env_vars: opt_param_usage_include_env: true opt_param_env_vars: - {env_var: "APP_ENV", env_value: "production", desc: "Default is `production` but can use `testing` or `develop`."} - - {env_var: "APP_KEY", env_value: "", desc: "App key used for encrypting stored data. Generate with `docker exec snipe-it php /app/www/artisan key:generate --show`."} - {env_var: "APP_DEBUG", env_value: "false", desc: "Set to `true` to see debugging output in the web UI."} - {env_var: "APP_LOCALE", env_value: "", desc: "Default is `en`. Set to a language from [this list](https://snipe-it.readme.io/docs/configuration#section-setting-a-language)."} - {env_var: "MAIL_PORT_587_TCP_ADDR", env_value: "", desc: "SMTP mail server ip or hostname."} diff --git a/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run b/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run index 30e4b193..3f991228 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run @@ -39,7 +39,7 @@ if [[ ! -f "/config/SNIPE_IT_APP_KEY.txt" ]] && [[ -z "${APP_KEY}" ]]; then echo "Generating SnipeIT app key for first run" key=$(php /app/www/artisan key:generate --show) printf "%s" "${key}" > /run/s6/container_environment/APP_KEY - echo "App Key set to ${key} you can set the APP_KEY environment variable to override" + echo "App Key set to ${key} you can set the APP_KEY environment variable to provide a persistent key." elif [[ -f "/config/SNIPE_IT_APP_KEY.txt" ]]; then printf '%s' "$(cat /config/SNIPE_IT_APP_KEY.txt)" > /run/s6/container_environment/APP_KEY fi From b8db0935745cff2f8378d783b52223106fec4c5c Mon Sep 17 00:00:00 2001 From: thespad Date: Mon, 17 Jun 2024 17:16:59 +0100 Subject: [PATCH 3/4] Add web CI, fix readme typo --- Jenkinsfile | 4 ++-- README.md | 2 +- jenkins-vars.yml | 4 ++-- readme-vars.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 706c3c49..048bc300 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,10 +30,10 @@ pipeline { DIST_IMAGE = 'alpine' MULTIARCH='true' CI='true' - CI_WEB='false' + CI_WEB='true' CI_PORT='80' CI_SSL='false' - CI_DELAY='60' + CI_DELAY='120' CI_DOCKERENV='APP_URL=http://localhost:80|NGINX_APP_URL=_|DB_CONNECTION=sqlite_testing' CI_AUTH='' CI_WEBPATH='' diff --git a/README.md b/README.md index 5e1c128c..925b1e10 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The architectures supported by this image are: ## Application Setup -"Access the webui at `:8080`, for more information check out [Snipe-it](https://github.com/snipe/snipe-it). +Access the webui at `:8080`, for more information check out [Snipe-it](https://github.com/snipe/snipe-it). **This container requires a MySQL or MariaDB server to connect to, we recommend [ours](https://github.com/linuxserver/docker-mariadb)** diff --git a/jenkins-vars.yml b/jenkins-vars.yml index d2016df8..09fcc094 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -20,10 +20,10 @@ repo_vars: - DIST_IMAGE = 'alpine' - MULTIARCH='true' - CI='true' - - CI_WEB='false' + - CI_WEB='true' - CI_PORT='80' - CI_SSL='false' - - CI_DELAY='60' + - CI_DELAY='120' - CI_DOCKERENV='APP_URL=http://localhost:80|NGINX_APP_URL=_|DB_CONNECTION=sqlite_testing' - CI_AUTH='' - CI_WEBPATH='' diff --git a/readme-vars.yml b/readme-vars.yml index 72b489b2..29bb7397 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -44,7 +44,7 @@ opt_param_env_vars: # application setup block app_setup_block_enabled: true app_setup_block: | - "Access the webui at `:8080`, for more information check out [{{ project_name|capitalize }}]({{ project_url }}). + Access the webui at `:8080`, for more information check out [{{ project_name|capitalize }}]({{ project_url }}). **This container requires a MySQL or MariaDB server to connect to, we recommend [ours](https://github.com/linuxserver/docker-mariadb)** From 5808fed8b34cb3dfa0c6d48068a8cbb4c9e4eb74 Mon Sep 17 00:00:00 2001 From: thespad Date: Mon, 17 Jun 2024 17:33:27 +0100 Subject: [PATCH 4/4] Add APP_FORCE_TLS to readme --- Jenkinsfile | 2 +- README.md | 15 +++++++-------- jenkins-vars.yml | 2 +- readme-vars.yml | 9 +++------ 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 048bc300..c3978c0c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { CI_DELAY='120' CI_DOCKERENV='APP_URL=http://localhost:80|NGINX_APP_URL=_|DB_CONNECTION=sqlite_testing' CI_AUTH='' - CI_WEBPATH='' + CI_WEBPATH='/setup' } stages { // Setup all the basic environment variables needed for the build diff --git a/README.md b/README.md index 925b1e10..3bc6b264 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,6 @@ Access the webui at `:8080`, for more information check out [Snipe-it]( **This container requires a MySQL or MariaDB server to connect to, we recommend [ours](https://github.com/linuxserver/docker-mariadb)** -### PHP customization - -This image uses our NGINX base image all override configuration files for PHP are located in `/config/php`. - ## Usage To help you get started creating a container from this image you can either use docker-compose or the docker cli. @@ -90,8 +86,9 @@ services: - MYSQL_DATABASE= - MYSQL_USER= - MYSQL_PASSWORD= - - APP_ENV=production #optional - APP_DEBUG=false #optional + - APP_ENV=production #optional + - APP_FORCE_TLS=false #optional - APP_LOCALE= #optional - MAIL_PORT_587_TCP_ADDR= #optional - MAIL_PORT_587_TCP_PORT= #optional @@ -122,8 +119,9 @@ docker run -d \ -e MYSQL_DATABASE= \ -e MYSQL_USER= \ -e MYSQL_PASSWORD= \ - -e APP_ENV=production `#optional` \ -e APP_DEBUG=false `#optional` \ + -e APP_ENV=production `#optional` \ + -e APP_FORCE_TLS=false `#optional` \ -e APP_LOCALE= `#optional` \ -e MAIL_PORT_587_TCP_ADDR= `#optional` \ -e MAIL_PORT_587_TCP_PORT= `#optional` \ @@ -155,8 +153,9 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e MYSQL_DATABASE=` | Mysql database to use | | `-e MYSQL_USER=` | Mysql user to use | | `-e MYSQL_PASSWORD=` | Mysql password to use | -| `-e APP_ENV=production` | Default is `production` but can use `testing` or `develop`. | | `-e APP_DEBUG=false` | Set to `true` to see debugging output in the web UI. | +| `-e APP_ENV=production` | Default is `production` but can use `testing` or `develop`. | +| `-e APP_FORCE_TLS=false` | Set to `true` if running behind a reverse proxy | | `-e APP_LOCALE=` | Default is `en`. Set to a language from [this list](https://snipe-it.readme.io/docs/configuration#section-setting-a-language). | | `-e MAIL_PORT_587_TCP_ADDR=` | SMTP mail server ip or hostname. | | `-e MAIL_PORT_587_TCP_PORT=` | SMTP mail server port. | @@ -328,7 +327,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions -* **31.05.24:** - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings. +* **17.06.24:** - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings. * **06.03.24:** - Existing users should update: site-confs/default.conf - Cleanup default site conf. * **17.02.24:** - Add php81-exif. * **03.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf) diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 09fcc094..4ada6c4d 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -26,6 +26,6 @@ repo_vars: - CI_DELAY='120' - CI_DOCKERENV='APP_URL=http://localhost:80|NGINX_APP_URL=_|DB_CONNECTION=sqlite_testing' - CI_AUTH='' - - CI_WEBPATH='' + - CI_WEBPATH='/setup' sponsor_links: - { name: "Snipe-IT", url: "https://snipeitapp.com/donate" } diff --git a/readme-vars.yml b/readme-vars.yml index 29bb7397..3ebb3697 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -31,8 +31,9 @@ param_env_vars: opt_param_usage_include_env: true opt_param_env_vars: - - {env_var: "APP_ENV", env_value: "production", desc: "Default is `production` but can use `testing` or `develop`."} - {env_var: "APP_DEBUG", env_value: "false", desc: "Set to `true` to see debugging output in the web UI."} + - {env_var: "APP_ENV", env_value: "production", desc: "Default is `production` but can use `testing` or `develop`."} + - {env_var: "APP_FORCE_TLS", env_value: "false", desc: "Set to `true` if running behind a reverse proxy"} - {env_var: "APP_LOCALE", env_value: "", desc: "Default is `en`. Set to a language from [this list](https://snipe-it.readme.io/docs/configuration#section-setting-a-language)."} - {env_var: "MAIL_PORT_587_TCP_ADDR", env_value: "", desc: "SMTP mail server ip or hostname."} - {env_var: "MAIL_PORT_587_TCP_PORT", env_value: "", desc: "SMTP mail server port."} @@ -48,13 +49,9 @@ app_setup_block: | **This container requires a MySQL or MariaDB server to connect to, we recommend [ours](https://github.com/linuxserver/docker-mariadb)** - ### PHP customization - - This image uses our NGINX base image all override configuration files for PHP are located in `/config/php`. - # changelog changelogs: - - {date: "31.05.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings."} + - {date: "17.06.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings."} - {date: "06.03.24:", desc: "Existing users should update: site-confs/default.conf - Cleanup default site conf."} - {date: "17.02.24:", desc: "Add php81-exif."} - {date: "03.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"}