From e735f61e57d132cfb89784fb8d95c8632384f7db Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 14 Jul 2019 14:40:43 -0400 Subject: [PATCH 1/4] persist laravel.log --- README.md | 1 + readme-vars.yml | 1 + root/etc/cont-init.d/50-config | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ed8273..80a714d 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **14.07.19:** - Save laravel.log to /config * **28.06.19:** - Rebasing to alpine 3.10. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. * **22.02.19:** - Rebasing to alpine 3.9. diff --git a/readme-vars.yml b/readme-vars.yml index 694ddac..3126775 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -52,6 +52,7 @@ app_setup_block: | # changelog changelogs: + - { date: "14.07.19:", desc: "Save laravel.log to /config" } - { date: "28.06.19:", desc: "Rebasing to alpine 3.10." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } - { date: "22.02.19:", desc: "Rebasing to alpine 3.9." } diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 1b012eb..8b99648 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -12,7 +12,8 @@ symlinks=( \ /var/www/localhost/heimdall/storage/app/public/icons \ /var/www/localhost/heimdall/app/SupportedApps \ /var/www/localhost/heimdall/database/app.sqlite \ -/var/www/localhost/heimdall/.env ) +/var/www/localhost/heimdall/.env \ +/var/www/localhost/heimdall/storage/logs/laravel.log ) for i in "${symlinks[@]}" do From 1f097316ec2ce25d22ea1981caa6842ab018869c Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 15 Jul 2019 12:22:06 -0400 Subject: [PATCH 2/4] logrotate for laravel log --- root/etc/cont-init.d/50-config | 11 ++++++++--- root/etc/logrotate.d/heimdall | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 root/etc/logrotate.d/heimdall diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 8b99648..95b2cb4 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -2,7 +2,8 @@ # make our folders mkdir -p \ - /config/www/{backgrounds,icons,avatars,SupportedApps} + /config/www/{backgrounds,icons,avatars,SupportedApps} \ + /config/log/heimdall # create symlinks @@ -12,8 +13,7 @@ symlinks=( \ /var/www/localhost/heimdall/storage/app/public/icons \ /var/www/localhost/heimdall/app/SupportedApps \ /var/www/localhost/heimdall/database/app.sqlite \ -/var/www/localhost/heimdall/.env \ -/var/www/localhost/heimdall/storage/logs/laravel.log ) +/var/www/localhost/heimdall/.env ) for i in "${symlinks[@]}" do @@ -21,6 +21,11 @@ do [[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i" done +[[ -e "/var/www/localhost/heimdall/storage/logs/laravel.log" && ! -L "/var/www/localhost/heimdall/storage/logs/laravel.log" ]] \ + && rm -rf "/var/www/localhost/heimdall/storage/logs/laravel.log" +[[ ! -L "/var/www/localhost/heimdall/storage/logs/laravel.log" ]] && \ + ln -s "/config/log/heimdall/laravel.log" "/var/www/localhost/heimdall/storage/logs/laravel.log" + # copy .env if not exists [[ ! -f /config/www/.env ]] && \ cp /var/www/localhost/heimdall/.env.example /config/www/.env && \ diff --git a/root/etc/logrotate.d/heimdall b/root/etc/logrotate.d/heimdall new file mode 100644 index 0000000..f777e6b --- /dev/null +++ b/root/etc/logrotate.d/heimdall @@ -0,0 +1,9 @@ +/config/log/heimdall/laravel.log { + size 5M + rotate 5 + compress + nodateext + notifempty + missingok + su abc abc +} \ No newline at end of file From 21e6d52b46d1b62217543304a69d8caa5f733ac9 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 15 Jul 2019 21:52:26 -0400 Subject: [PATCH 3/4] install heimdall during first run --- Dockerfile | 10 ++-------- Dockerfile.aarch64 | 12 +++--------- Dockerfile.armhf | 12 +++--------- root/etc/cont-init.d/50-config | 13 +++++++++++++ 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4031c32..e522330 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,20 +21,14 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /var/www/localhost/heimdall && \ + /heimdall && \ if [ -z ${HEIMDALL_RELEASE+x} ]; then \ HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/heimdall.tar.gz -L \ + /heimdall/heimdall.tar.gz -L \ "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo "**** configure nginx ****" && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 7322f30..395f7de 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -21,20 +21,14 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /var/www/localhost/heimdall && \ + /heimdall && \ if [ -z ${HEIMDALL_RELEASE+x} ]; then \ HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/heimdall.tar.gz -L \ + /heimdall/heimdall.tar.gz -L \ "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo "**** configure nginx ****" && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 80f0764..ffbc714 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -21,20 +21,14 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /var/www/localhost/heimdall && \ + /heimdall && \ if [ -z ${HEIMDALL_RELEASE+x} ]; then \ HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/heimdall.tar.gz -L \ + /heimdall/heimdall.tar.gz -L \ "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo "**** configure nginx ****" && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 95b2cb4..2b42b61 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -3,8 +3,20 @@ # make our folders mkdir -p \ /config/www/{backgrounds,icons,avatars,SupportedApps} \ + /var/www/localhost/heimdall \ /config/log/heimdall +# install heimdall if necessary +[[ -f /heimdall/heimdall.tar.gz ]] && \ + echo "New container detected, installing Heimdall" && \ + tar xf \ + /heimdall/heimdall.tar.gz -C \ + /var/www/localhost/heimdall --strip-components=1 && \ + echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ + /etc/nginx/fastcgi_params && \ + rm -rf /heimdall && \ + chown -R abc:abc /var/www/localhost/heimdall + # create symlinks symlinks=( \ @@ -29,6 +41,7 @@ done # copy .env if not exists [[ ! -f /config/www/.env ]] && \ cp /var/www/localhost/heimdall/.env.example /config/www/.env && \ + echo "generating app key" php /var/www/localhost/heimdall/artisan key:generate # set queue driver to database sed -i 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' /config/www/.env From ec07bff1acdb88189f5168055e1e14168c731270 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 15 Jul 2019 21:56:32 -0400 Subject: [PATCH 4/4] update readme --- README.md | 2 +- readme-vars.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80a714d..36b5d3e 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions -* **14.07.19:** - Save laravel.log to /config +* **15.07.19:** - Save laravel.log to /config, install heimdall during first start. * **28.06.19:** - Rebasing to alpine 3.10. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. * **22.02.19:** - Rebasing to alpine 3.9. diff --git a/readme-vars.yml b/readme-vars.yml index 3126775..a091791 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -52,7 +52,7 @@ app_setup_block: | # changelog changelogs: - - { date: "14.07.19:", desc: "Save laravel.log to /config" } + - { date: "15.07.19:", desc: "Save laravel.log to /config, install heimdall during first start." } - { date: "28.06.19:", desc: "Rebasing to alpine 3.10." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } - { date: "22.02.19:", desc: "Rebasing to alpine 3.9." }