mirror of
https://github.com/linuxserver/docker-bookstack.git
synced 2026-02-20 02:30:30 +08:00
commit
0dd9c4b46f
64
Dockerfile
64
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.14
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15
|
||||
|
||||
# set version label
|
||||
ARG BUILD_DATE
|
||||
@ -11,56 +11,62 @@ LABEL maintainer="homerr"
|
||||
ARG BOOKSTACK_RELEASE
|
||||
|
||||
RUN \
|
||||
echo "**** install packages ****" && \
|
||||
apk add --no-cache \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --virtual=build-dependencies \
|
||||
composer && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
composer \
|
||||
fontconfig \
|
||||
memcached \
|
||||
netcat-openbsd \
|
||||
php7-ctype \
|
||||
php7-curl \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-ldap \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-mysqlnd \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
php7-phar \
|
||||
php7-simplexml \
|
||||
php7-tokenizer \
|
||||
php8-ctype \
|
||||
php8-curl \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-ldap \
|
||||
php8-mbstring \
|
||||
php8-mysqlnd \
|
||||
php8-openssl \
|
||||
php8-pdo_mysql \
|
||||
php8-pecl-memcached \
|
||||
php8-phar \
|
||||
php8-simplexml \
|
||||
php8-tokenizer \
|
||||
qt5-qtbase \
|
||||
tar \
|
||||
ttf-freefont \
|
||||
ttf-freefont && \
|
||||
apk add --no-cache \
|
||||
--repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \
|
||||
wkhtmltopdf && \
|
||||
echo "**** configure php-fpm ****" && \
|
||||
sed -i 's/;clear_env = no/clear_env = no/g' /etc/php7/php-fpm.d/www.conf && \
|
||||
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php7/php-fpm.conf && \
|
||||
echo "**** configure php-fpm to pass env vars ****" && \
|
||||
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \
|
||||
grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \
|
||||
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php8/php-fpm.conf && \
|
||||
echo "**** fetch bookstack ****" && \
|
||||
mkdir -p\
|
||||
/var/www/html && \
|
||||
/app/www && \
|
||||
if [ -z ${BOOKSTACK_RELEASE+x} ]; then \
|
||||
BOOKSTACK_RELEASE=$(curl -sX GET "https://api.github.com/repos/bookstackapp/bookstack/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/bookstack.tar.gz -L \
|
||||
/tmp/bookstack.tar.gz -L \
|
||||
"https://github.com/BookStackApp/BookStack/archive/${BOOKSTACK_RELEASE}.tar.gz" && \
|
||||
tar xf \
|
||||
/tmp/bookstack.tar.gz -C \
|
||||
/var/www/html/ --strip-components=1 && \
|
||||
/tmp/bookstack.tar.gz -C \
|
||||
/app/www/ --strip-components=1 && \
|
||||
echo "**** install composer dependencies ****" && \
|
||||
composer install -d /var/www/html/ && \
|
||||
composer install -d /app/www/ && \
|
||||
echo "**** overlay-fs bug workaround ****" && \
|
||||
mv /var/www /var/www-tmp && \
|
||||
mv /app/www /app/www-tmp && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
|
||||
COPY root/ /
|
||||
|
||||
VOLUME /config
|
||||
EXPOSE 80
|
||||
EXPOSE 80 443
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.14
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15
|
||||
|
||||
# set version label
|
||||
ARG BUILD_DATE
|
||||
@ -11,56 +11,62 @@ LABEL maintainer="homerr"
|
||||
ARG BOOKSTACK_RELEASE
|
||||
|
||||
RUN \
|
||||
echo "**** install packages ****" && \
|
||||
apk add --no-cache \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --virtual=build-dependencies \
|
||||
composer && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
composer \
|
||||
fontconfig \
|
||||
memcached \
|
||||
netcat-openbsd \
|
||||
php7-ctype \
|
||||
php7-curl \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-ldap \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-mysqlnd \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
php7-phar \
|
||||
php7-simplexml \
|
||||
php7-tokenizer \
|
||||
php8-ctype \
|
||||
php8-curl \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-ldap \
|
||||
php8-mbstring \
|
||||
php8-mysqlnd \
|
||||
php8-openssl \
|
||||
php8-pdo_mysql \
|
||||
php8-pecl-memcached \
|
||||
php8-phar \
|
||||
php8-simplexml \
|
||||
php8-tokenizer \
|
||||
qt5-qtbase \
|
||||
tar \
|
||||
ttf-freefont \
|
||||
ttf-freefont && \
|
||||
apk add --no-cache \
|
||||
--repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \
|
||||
wkhtmltopdf && \
|
||||
echo "**** configure php-fpm ****" && \
|
||||
sed -i 's/;clear_env = no/clear_env = no/g' /etc/php7/php-fpm.d/www.conf && \
|
||||
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php7/php-fpm.conf && \
|
||||
echo "**** configure php-fpm to pass env vars ****" && \
|
||||
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \
|
||||
grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \
|
||||
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php8/php-fpm.conf && \
|
||||
echo "**** fetch bookstack ****" && \
|
||||
mkdir -p\
|
||||
/var/www/html && \
|
||||
/app/www && \
|
||||
if [ -z ${BOOKSTACK_RELEASE+x} ]; then \
|
||||
BOOKSTACK_RELEASE=$(curl -sX GET "https://api.github.com/repos/bookstackapp/bookstack/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/bookstack.tar.gz -L \
|
||||
/tmp/bookstack.tar.gz -L \
|
||||
"https://github.com/BookStackApp/BookStack/archive/${BOOKSTACK_RELEASE}.tar.gz" && \
|
||||
tar xf \
|
||||
/tmp/bookstack.tar.gz -C \
|
||||
/var/www/html/ --strip-components=1 && \
|
||||
/tmp/bookstack.tar.gz -C \
|
||||
/app/www/ --strip-components=1 && \
|
||||
echo "**** install composer dependencies ****" && \
|
||||
composer install -d /var/www/html/ && \
|
||||
composer install -d /app/www/ && \
|
||||
echo "**** overlay-fs bug workaround ****" && \
|
||||
mv /var/www /var/www-tmp && \
|
||||
mv /app/www /app/www-tmp && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
|
||||
COPY root/ /
|
||||
|
||||
VOLUME /config
|
||||
EXPOSE 80
|
||||
EXPOSE 80 443
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.14
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15
|
||||
|
||||
# set version label
|
||||
ARG BUILD_DATE
|
||||
@ -11,56 +11,62 @@ LABEL maintainer="homerr"
|
||||
ARG BOOKSTACK_RELEASE
|
||||
|
||||
RUN \
|
||||
echo "**** install packages ****" && \
|
||||
apk add --no-cache \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --virtual=build-dependencies \
|
||||
composer && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
composer \
|
||||
fontconfig \
|
||||
memcached \
|
||||
netcat-openbsd \
|
||||
php7-ctype \
|
||||
php7-curl \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-ldap \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-mysqlnd \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
php7-phar \
|
||||
php7-simplexml \
|
||||
php7-tokenizer \
|
||||
php8-ctype \
|
||||
php8-curl \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-ldap \
|
||||
php8-mbstring \
|
||||
php8-mysqlnd \
|
||||
php8-openssl \
|
||||
php8-pdo_mysql \
|
||||
php8-pecl-memcached \
|
||||
php8-phar \
|
||||
php8-simplexml \
|
||||
php8-tokenizer \
|
||||
qt5-qtbase \
|
||||
tar \
|
||||
ttf-freefont \
|
||||
ttf-freefont && \
|
||||
apk add --no-cache \
|
||||
--repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \
|
||||
wkhtmltopdf && \
|
||||
echo "**** configure php-fpm ****" && \
|
||||
sed -i 's/;clear_env = no/clear_env = no/g' /etc/php7/php-fpm.d/www.conf && \
|
||||
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php7/php-fpm.conf && \
|
||||
echo "**** configure php-fpm to pass env vars ****" && \
|
||||
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \
|
||||
grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \
|
||||
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php8/php-fpm.conf && \
|
||||
echo "**** fetch bookstack ****" && \
|
||||
mkdir -p\
|
||||
/var/www/html && \
|
||||
/app/www && \
|
||||
if [ -z ${BOOKSTACK_RELEASE+x} ]; then \
|
||||
BOOKSTACK_RELEASE=$(curl -sX GET "https://api.github.com/repos/bookstackapp/bookstack/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/bookstack.tar.gz -L \
|
||||
/tmp/bookstack.tar.gz -L \
|
||||
"https://github.com/BookStackApp/BookStack/archive/${BOOKSTACK_RELEASE}.tar.gz" && \
|
||||
tar xf \
|
||||
/tmp/bookstack.tar.gz -C \
|
||||
/var/www/html/ --strip-components=1 && \
|
||||
/tmp/bookstack.tar.gz -C \
|
||||
/app/www/ --strip-components=1 && \
|
||||
echo "**** install composer dependencies ****" && \
|
||||
composer install -d /var/www/html/ && \
|
||||
composer install -d /app/www/ && \
|
||||
echo "**** overlay-fs bug workaround ****" && \
|
||||
mv /var/www /var/www-tmp && \
|
||||
mv /app/www /app/www-tmp && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
|
||||
COPY root/ /
|
||||
|
||||
VOLUME /config
|
||||
EXPOSE 80
|
||||
EXPOSE 80 443
|
||||
|
||||
@ -271,6 +271,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
|
||||
|
||||
## Versions
|
||||
|
||||
* **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)).
|
||||
* **14.03.22:** - Add symlinks for theme support.
|
||||
* **11.07.21:** - Rebase to Alpine 3.14.
|
||||
* **12.01.21:** - Remove unused requirement, as of release 0.31.0.
|
||||
|
||||
@ -101,6 +101,7 @@ app_setup_block: |
|
||||
|
||||
# changelog
|
||||
changelogs:
|
||||
- { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." }
|
||||
- { date: "14.03.22:", desc: "Add symlinks for theme support." }
|
||||
- { date: "11.07.21:", desc: "Rebase to Alpine 3.14." }
|
||||
- { date: "12.01.21:", desc: "Remove unused requirement, as of release 0.31.0." }
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
## Version 2018/03/06 - Changelog: https://github.com/linuxserver/docker-heimdall/commits/master/root/defaults/default
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
|
||||
listen 443 ssl;
|
||||
|
||||
root /var/www/html/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
server_name _;
|
||||
|
||||
ssl_certificate /config/keys/cert.crt;
|
||||
ssl_certificate_key /config/keys/cert.key;
|
||||
|
||||
client_max_body_size 0;
|
||||
|
||||
error_page 599 = @noauth;
|
||||
|
||||
location @noauth {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
# With php5-cgi alone:
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
# With php5-fpm:
|
||||
#fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
user abc;
|
||||
worker_processes 4;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
|
||||
client_max_body_size 0;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /config/log/nginx/access.log;
|
||||
error_log /config/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
# gzip_vary on;
|
||||
# gzip_proxied any;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_buffers 16 8k;
|
||||
# gzip_http_version 1.1;
|
||||
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
##
|
||||
# nginx-naxsi config
|
||||
##
|
||||
# Uncomment it if you installed nginx-naxsi
|
||||
##
|
||||
|
||||
#include /etc/nginx/naxsi_core.rules;
|
||||
|
||||
##
|
||||
# nginx-passenger config
|
||||
##
|
||||
# Uncomment it if you installed nginx-passenger
|
||||
##
|
||||
|
||||
#passenger_root /usr;
|
||||
#passenger_ruby /usr/bin/ruby;
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /config/nginx/site-confs/*;
|
||||
}
|
||||
|
||||
|
||||
#mail {
|
||||
# # See sample authentication script at:
|
||||
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
||||
#
|
||||
# # auth_http localhost/auth.php;
|
||||
# # pop3_capabilities "TOP" "USER";
|
||||
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
||||
#
|
||||
# server {
|
||||
# listen localhost:110;
|
||||
# protocol pop3;
|
||||
# proxy on;
|
||||
# }
|
||||
#
|
||||
# server {
|
||||
# listen localhost:143;
|
||||
# protocol imap;
|
||||
# proxy on;
|
||||
# }
|
||||
#}
|
||||
daemon off;
|
||||
40
root/defaults/nginx/site-confs/default.conf.sample
Normal file
40
root/defaults/nginx/site-confs/default.conf.sample
Normal file
@ -0,0 +1,40 @@
|
||||
## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-bookstack/commits/master/root/defaults/nginx/site-confs/default.conf.sample
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name _;
|
||||
|
||||
root /app/www/public;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
error_page 599 = @noauth;
|
||||
|
||||
location @noauth {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location / {
|
||||
# enable for basic auth
|
||||
#auth_basic "Restricted";
|
||||
#auth_basic_user_file /config/nginx/.htpasswd;
|
||||
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ ^(.+\.php)(.*)$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
}
|
||||
|
||||
# deny access to .htaccess/.htpasswd files
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
if [ -d /var/www-tmp ]; then
|
||||
if [ -d /app/www-tmp ]; then
|
||||
echo "New container detected. Setting up app folder and fixing permissions."
|
||||
mv /var/www-tmp /var/www
|
||||
chown -R abc:abc /var/www
|
||||
mv /app/www-tmp /app/www
|
||||
chown -R abc:abc /app/www
|
||||
fi
|
||||
|
||||
# create directory structure
|
||||
@ -11,52 +11,53 @@ mkdir -p \
|
||||
/config/www/{uploads,files,images,themes}
|
||||
|
||||
# check for .env and copy default if needed
|
||||
[[ ! -f "/config/www/.env" ]] && \
|
||||
cp /var/www/html/.env.example /config/www/.env
|
||||
|
||||
# check for zero-length .env and alert user if found
|
||||
[[ ! -s "/config/www/.env" ]] && \
|
||||
echo "WARNING: zero-length .env file detected. Please delete /config/www/.env and restart the container"
|
||||
if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then
|
||||
cp /app/www/.env.example /config/www/.env
|
||||
fi
|
||||
|
||||
# create symlinks
|
||||
symlinks=( \
|
||||
/var/www/html/themes \
|
||||
/var/www/html/storage/uploads/files \
|
||||
/var/www/html/storage/uploads/images \
|
||||
/var/www/html/public/uploads \
|
||||
/var/www/html/.env \
|
||||
/var/www/html/storage/logs/laravel.log
|
||||
/app/www/themes \
|
||||
/app/www/storage/uploads/files \
|
||||
/app/www/storage/uploads/images \
|
||||
/app/www/public/uploads \
|
||||
/app/www/.env \
|
||||
/app/www/storage/logs/laravel.log
|
||||
)
|
||||
|
||||
for i in "${symlinks[@]}"
|
||||
do
|
||||
[[ -e "$i" && ! -L "$i" ]] && rm -rf "$i"
|
||||
[[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i"
|
||||
if [[ -e "$i" && ! -L "$i" ]]; then
|
||||
rm -rf "$i"
|
||||
fi
|
||||
if [[ ! -L "$i" ]]; then
|
||||
ln -s /config/www/"$(basename "$i")" "$i"
|
||||
fi
|
||||
done
|
||||
|
||||
# Echo init finish for test runs
|
||||
if [ -n "${TEST_RUN}" ]; then
|
||||
echo '[services.d] done.'
|
||||
echo '[services.d] done.'
|
||||
fi
|
||||
|
||||
# Create API key if needed
|
||||
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ];
|
||||
then
|
||||
echo "Generating BookStack app key for first run"
|
||||
key=$(php /var/www/html/artisan key:generate --show)
|
||||
echo $key > /config/BOOKSTACK_APP_KEY.txt
|
||||
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
|
||||
then
|
||||
echo "Generating BookStack app key for first run"
|
||||
key=$(php /app/www/artisan key:generate --show)
|
||||
echo $key > /config/BOOKSTACK_APP_KEY.txt
|
||||
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
|
||||
elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ];
|
||||
then
|
||||
echo "App Key found - setting variable for seds"
|
||||
key=$(cat /config/BOOKSTACK_APP_KEY.txt)
|
||||
then
|
||||
echo "App Key found - setting variable for seds"
|
||||
key=$(cat /config/BOOKSTACK_APP_KEY.txt)
|
||||
fi
|
||||
|
||||
# .env file setup
|
||||
# check for the default app key or if it has been updated
|
||||
if grep -Fxq "APP_KEY=SomeRandomString" /config/www/.env || \
|
||||
! grep -Fxq "APP_KEY=${key}" /config/www/.env; then
|
||||
sed -i "s#^APP_KEY=.*#APP_KEY=${key}#" /config/www/.env
|
||||
sed -i "s#^APP_KEY=.*#APP_KEY=${key}#" /config/www/.env
|
||||
fi
|
||||
# check to see if db_user is set, if it is then run seds and if not then leave them
|
||||
if [ "${DB_USER}" ];
|
||||
@ -71,49 +72,58 @@ fi
|
||||
|
||||
# set appurl
|
||||
if [ -z "${APP_URL}" ]; then
|
||||
EXT_IP=$(curl -s https://icanhazip.com)
|
||||
APP_URL="http://${EXT_IP}:6875"
|
||||
echo "**** Docker env var APP_URL is not set, setting it to ${APP_URL} ****"
|
||||
EXT_IP=$(curl -s https://icanhazip.com)
|
||||
APP_URL="http://${EXT_IP}:6875"
|
||||
echo "**** Docker env var APP_URL is not set, setting it to ${APP_URL} ****"
|
||||
fi
|
||||
OLD_URL=$(grep APP_URL /config/www/.env | sed 's|.*APP_URL=||g')
|
||||
if [ "${APP_URL}" != "${OLD_URL}" ]; then
|
||||
sed -r "s,([#\s]*)?APP_URL=.*,APP_URL=${APP_URL},g" -i /config/www/.env
|
||||
echo "**** APP_URL in /config/www/.env is being updated from ${OLD_URL} to ${APP_URL} ****"
|
||||
if [ "${OLD_URL}" != "http://example.com" ]; then
|
||||
echo "**** If this is an existing install, you should run the following line from your host terminal to update the database URL entries: ****"
|
||||
echo "************************************************************************"
|
||||
echo "docker exec -it bookstack php /var/www/html/artisan bookstack:update-url ${OLD_URL} ${APP_URL}"
|
||||
echo "************************************************************************"
|
||||
fi
|
||||
sed -r "s,([#\s]*)?APP_URL=.*,APP_URL=${APP_URL},g" -i /config/www/.env
|
||||
echo "**** APP_URL in /config/www/.env is being updated from ${OLD_URL} to ${APP_URL} ****"
|
||||
if [ "${OLD_URL}" != "http://example.com" ]; then
|
||||
echo "**** If this is an existing install, you should run the following line from your host terminal to update the database URL entries: ****"
|
||||
echo "************************************************************************"
|
||||
echo "docker exec -it bookstack php /app/www/artisan bookstack:update-url ${OLD_URL} ${APP_URL}"
|
||||
echo "************************************************************************"
|
||||
fi
|
||||
fi
|
||||
|
||||
## Bump php upload max filesize and post max size to 100MB by default
|
||||
grep -qx '^upload_max_filesize.*$' /config/php/php-local.ini || echo 'upload_max_filesize = 100M' >> /config/php/php-local.ini
|
||||
grep -qx '^post_max_size.*$' /config/php/php-local.ini || echo 'post_max_size = 100M' >> /config/php/php-local.ini
|
||||
if ! grep -qx '^upload_max_filesize.*$' /config/php/php-local.ini; then
|
||||
echo 'upload_max_filesize = 100M' >> /config/php/php-local.ini
|
||||
fi
|
||||
if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
|
||||
echo 'post_max_size = 100M' >> /config/php/php-local.ini
|
||||
fi
|
||||
|
||||
# check for the mysql endpoint for 30 seconds
|
||||
END=$((SECONDS+30))
|
||||
while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST+x}" ]; do
|
||||
/usr/bin/nc -z ${DB_HOST} 3306 && \
|
||||
if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} 3306)" ]; then
|
||||
[ ! -z "${RUN}" ] && break
|
||||
RUN="RAN"
|
||||
# we sleep here again due to first run init on DB containers
|
||||
[ ! -f /dbwait.lock ] && sleep 5
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
sleep 1
|
||||
if /usr/bin/nc -z ${DB_HOST} 3306; then
|
||||
if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} 3306)" ]; then
|
||||
if [ ! -z "${RUN}" ]; then
|
||||
break
|
||||
fi
|
||||
RUN="RAN"
|
||||
# we sleep here again due to first run init on DB containers
|
||||
if [ ! -f /dbwait.lock ]; then
|
||||
sleep 5
|
||||
fi
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# update database - will set up database if fresh, or, migrate existing
|
||||
if [ -z "${CI_RUN+x}" ]; then
|
||||
php /var/www/html/artisan migrate --force
|
||||
php /app/www/artisan migrate --force
|
||||
fi
|
||||
|
||||
# set permissions
|
||||
chown -R abc:abc \
|
||||
/config
|
||||
/config
|
||||
|
||||
# set lockfile to avoid DB waits for this specific container
|
||||
touch /dbwait.lock
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
exec /usr/sbin/php-fpm7 -F
|
||||
10
root/migrations/02-default-location
Normal file
10
root/migrations/02-default-location
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
DEFAULT_CONF="/config/nginx/site-confs/default.conf"
|
||||
OLD_ROOT="root /var/www/html/public;"
|
||||
NEW_ROOT="root /app/www/public;"
|
||||
|
||||
if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}";then
|
||||
echo "updating root in ${DEFAULT_CONF}"
|
||||
sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}"
|
||||
fi
|
||||
40
root/var/www/html/public/index.html
Normal file
40
root/var/www/html/public/index.html
Normal file
@ -0,0 +1,40 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Upgrade Required!</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.message{
|
||||
width:440px;
|
||||
padding:20px 40px;
|
||||
margin:0 auto;
|
||||
background-color:#f9f9f9;
|
||||
border:1px solid #ddd;
|
||||
color: #1e3d62;
|
||||
}
|
||||
center{
|
||||
margin:40px 0;
|
||||
}
|
||||
h1{
|
||||
font-size: 18px;
|
||||
line-height: 26px;
|
||||
}
|
||||
p{
|
||||
font-size: 12px;
|
||||
}
|
||||
a{
|
||||
color: rgb(207, 48, 139);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="message">
|
||||
<h1>Upgrade Required!</h1>
|
||||
<p>The application inside this image has been moved to a new folder.</p>
|
||||
<p>You will need to update your <strong>/config/nginx/nginx.conf</strong> and <strong>/config/nginx/site-confs/default.conf</strong> in order for the application to work.</p>
|
||||
<p>New config samples are located at <strong>/config/nginx/nginx.conf.sample</strong> and <strong>/config/nginx/site-confs/default.conf.sample</strong></p>
|
||||
<p>Please review our announcement: <a target="_blank" href="https://info.linuxserver.io/issues/2022-08-20-nginx-base/">Significant changes to nginx based images</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user