Compare commits

...

20 Commits

Author SHA1 Message Date
TBK 69cf33eb47
Entrypoint tweaks 2021-02-25 22:49:25 +01:00
TBK a4cbf7d5eb
Switch to Alpine 3.13 2021-02-25 10:59:34 +01:00
TBK 94eba4bee2
Update to 0.31.6 2021-02-25 10:56:21 +01:00
TBK c1cfee6015
Update php-pm to 2.2.1 2021-02-25 10:54:52 +01:00
TBK 29019dba13
Update to 0.31.4 2021-01-19 20:17:04 +01:00
TBK d569da71c8
Update to 0.31.0 2021-01-03 23:43:55 +01:00
TBK 206d5c8c8c
Update php-pm to 2.2.0 2021-01-03 23:42:19 +01:00
TBK 29c35e9d7d
Fix permission issue 2020-09-24 12:24:13 +02:00
TBK 081fbc8d33
Update to 0.30.0
- Bump to Alpine 3.12
- Bump MariaDB to 10.5
2020-09-24 10:06:47 +02:00
TBK c0c1f12a18
Update php-pm-httpkernel to 2.0.6 2020-09-24 09:55:37 +02:00
TBK ff4b1c31bd
Update php-pm to 2.1.3 2020-09-24 09:55:02 +02:00
TBK 1158aaf00b
Drop docker nomenclature 2020-05-02 18:11:15 +02:00
TBK 3d81d62267
Update to 0.29.2 2020-05-02 18:00:05 +02:00
TBK b3168c5a46
Propagate CHLD and USR1 signal to the Process Manager
https://github.com/php-pm/php-pm-docker/pull/11
2020-04-23 10:39:24 +02:00
TBK afa2849574
Update php-pm-httpkernel to 2.0.3 2020-04-23 09:15:39 +02:00
TBK fd378ef714
Change php session cache to redis db 1 2020-04-08 09:28:36 +02:00
TBK a1824850c9
Use multirun 2020-04-08 09:23:47 +02:00
TBK 8689818ac9
Add bookstack user 2020-04-08 09:23:47 +02:00
TBK e6784c2e5e
Small tweaks 2020-04-08 09:13:51 +02:00
TBK d78380caf0
Update to 0.28.3 2020-03-15 00:27:03 +01:00
9 changed files with 53 additions and 163 deletions

View File

@ -7,9 +7,6 @@ APP_ENV=production
APP_DEBUG=false APP_DEBUG=false
APP_KEY=------------REPLACE_ME------------ APP_KEY=------------REPLACE_ME------------
# Timezone
TZ=------------REPLACE_ME------------
# The below url has to be set if using social auth options # The below url has to be set if using social auth options
# or if you are not using BookStack at the root path of your domain. # or if you are not using BookStack at the root path of your domain.
APP_URL=https://bookstackapp.com ------------REPLACE_ME------------ APP_URL=https://bookstackapp.com ------------REPLACE_ME------------

View File

@ -1,8 +1,8 @@
# bookstack-ppm # bookstack-ppm
[![Build Status](https://cloud.drone.io/api/badges/JJTC-Docker/bookstack-ppm/status.svg)](https://cloud.drone.io/JJTC-Docker/bookstack-ppm) [![Build Status](https://cloud.drone.io/api/badges/JJTC-Containers/bookstack-ppm/status.svg)](https://cloud.drone.io/JJTC-Containers/bookstack-ppm)
[![Docker Pulls](https://img.shields.io/docker/pulls/jjtc/bookstack-ppm.svg?style=flat)](https://hub.docker.com/r/jjtc/bookstack-ppm/) [![Docker Pulls](https://img.shields.io/docker/pulls/jjtc/bookstack-ppm.svg?style=flat)](https://hub.docker.com/r/jjtc/bookstack-ppm/)
[![Github Stars](https://img.shields.io/github/stars/jjtc-docker/bookstack-ppm.svg?style=flat)](https://github.com/jjtc-docker/bookstack-ppm) [![Github Stars](https://img.shields.io/github/stars/jjtc-containers/bookstack-ppm.svg?style=flat)](https://github.com/jjtc-containers/bookstack-ppm)
[![Github Forks](https://img.shields.io/github/forks/jjtc-docker/bookstack-ppm.svg?style=flat?label=github%20forks)](https://github.com/jjtc-docker/bookstack-ppm) [![Github Forks](https://img.shields.io/github/forks/jjtc-containers/bookstack-ppm.svg?style=flat?label=github%20forks)](https://github.com/jjtc-containers/bookstack-ppm)
[![PPM Compatible](https://raw.githubusercontent.com/php-pm/ppm-badge/master/ppm-badge.png)](https://github.com/php-pm/php-pm) [![PPM Compatible](https://raw.githubusercontent.com/php-pm/ppm-badge/master/ppm-badge.png)](https://github.com/php-pm/php-pm)
Bookstack setup based on Alpine, Nginx, PHP-PM, MariaDB, Redis & ClamAV for use with Træfik Bookstack setup based on Alpine, Nginx, PHP-PM, MariaDB, Redis & ClamAV for use with Træfik

View File

@ -1,25 +1,28 @@
FROM alpine:3.11 FROM alpine:3.13
LABEL maintainer="JJTC <docker@jjtc.eu>" LABEL maintainer="JJTC <oci@jjtc.eu>"
ENV PPM_VERSION=2.0.3 \ ENV PPM_VERSION=2.2.1 \
PPM_HTTP_VERSION=2.0.2 \ PPM_HTTP_VERSION=2.0.6 \
BOOKSTACK=BookStack \ BOOKSTACK=BookStack \
BOOKSTACK_VERSION=0.28.2 \ BOOKSTACK_VERSION=0.31.6 \
BOOKSTACK_HOME="/app" BOOKSTACK_HOME="/app"
COPY docker-entrypoint.sh /app/docker-entrypoint.sh COPY entrypoint.sh /app/entrypoint.sh
RUN set -ex \ RUN set -ex \
&& chmod +x /app/docker-entrypoint.sh \ && chmod +x /app/entrypoint.sh \
# ensure www-data user exists # ensure www-data user exists
# 82 is the standard uid/gid for "www-data" in Alpine # 82 is the standard uid/gid for "www-data" in Alpine
&& addgroup -g 82 -S www-data \ && addgroup -g 82 -S www-data \
&& adduser -u 82 -D -S -G www-data www-data \ && adduser -u 82 -D -S -G www-data www-data \
&& addgroup -S bookstack \
&& adduser -S -D -H -s /sbin/nologin -G bookstack -g bookstack bookstack \
&& apk update \ && apk update \
&& echo "Setting up PHP extensions" \ && echo "Getting packages:" \
&& apk add --no-cache \ && apk add --no-cache \
curl \ curl \
multirun \
nginx \ nginx \
tar \ tar \
php7 \ php7 \
@ -47,7 +50,6 @@ RUN set -ex \
php7-session \ php7-session \
php7-simplexml \ php7-simplexml \
php7-sockets \ php7-sockets \
php7-tidy \
php7-tokenizer \ php7-tokenizer \
php7-xml \ php7-xml \
php7-xmlwriter \ php7-xmlwriter \
@ -56,28 +58,32 @@ RUN set -ex \
composer \ composer \
&& echo "Setting up PPM:" \ && echo "Setting up PPM:" \
&& mkdir -p /ppm/run \ && mkdir -p /ppm/run \
&& chmod 0777 /ppm/run \
&& cd /ppm \ && cd /ppm \
&& chmod -R 777 run/ \
&& composer require php-pm/php-pm:${PPM_VERSION} php-pm/httpkernel-adapter:${PPM_HTTP_VERSION} \ && composer require php-pm/php-pm:${PPM_VERSION} php-pm/httpkernel-adapter:${PPM_HTTP_VERSION} \
&& chown www-data:www-data -R . \ && chown www-data:www-data -R . \
&& echo "Get BookStack:" \ && echo "Getting BookStack:" \
&& mkdir -p ${BOOKSTACK_HOME} \ && mkdir -p ${BOOKSTACK_HOME} \
&& cd ${BOOKSTACK_HOME} \ && cd ${BOOKSTACK_HOME} \
&& curl -LJO https://github.com/BookStackApp/BookStack/archive/v${BOOKSTACK_VERSION}.tar.gz \ && curl -LJO https://github.com/BookStackApp/BookStack/archive/v${BOOKSTACK_VERSION}.tar.gz \
&& tar --strip-components=1 -xzf BookStack-${BOOKSTACK_VERSION}.tar.gz \ && tar --strip-components=1 -xzf BookStack-${BOOKSTACK_VERSION}.tar.gz \
&& rm -rf ${BOOKSTACK}-${BOOKSTACK_VERSION}.tar.gz .env.example .gitattributes .github .gitignore .travis.yml tests/ public/index.php \ && rm -rf ${BOOKSTACK}-${BOOKSTACK_VERSION}.tar.gz .env.example .env.example.complete .gitattributes .github .gitignore .travis.yml tests/ public/index.php \
&& ln -s init.php bootstrap/autoload.php \ && ln -s init.php bootstrap/autoload.php \
&& curl -LJO https://gist.githubusercontent.com/TBK/6abf876e9559cf2477ad0d16bbf648db/raw/ba66290094f7362203949b608749cefbc96652c7/validator_and_shelf_cover_fix.patch \ && echo "Getting BookStack Dependencies:" \
&& patch -p1 < validator_and_shelf_cover_fix.patch \
&& rm validator_and_shelf_cover_fix.patch \
&& echo "Get Dependencies:" \
&& composer install \ && composer install \
&& echo "Changing ownership:" \ && echo "Changing ownership:" \
&& chown www-data:www-data -R . \ && chown bookstack:bookstack -R . \
&& echo "Ensure www-data got access to Nginx folders:" \ && echo "Setting folder permissions for www-data:" \
&& chown www-data:www-data -R /var/lib/nginx /var/log/nginx && chown www-data:bookstack -R bootstrap/cache public/uploads storage \
&& echo "Ensuring www-data got access to Nginx folders:" \
&& chown www-data:www-data -R /var/lib/nginx /var/log/nginx \
&& echo "Redirecting Nginx logs to stdout and stderr:" \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& echo "Giving all system users access to multirun:" \
&& chmod 0755 /usr/bin/multirun
USER www-data:www-data USER www-data
WORKDIR $BOOKSTACK_HOME WORKDIR $BOOKSTACK_HOME
@ -85,4 +91,4 @@ EXPOSE 8080/tcp
VOLUME ["$BOOKSTACK_HOME/public/uploads", "$BOOKSTACK_HOME/public/storage"] VOLUME ["$BOOKSTACK_HOME/public/uploads", "$BOOKSTACK_HOME/public/storage"]
ENTRYPOINT ["./docker-entrypoint.sh"] ENTRYPOINT ["multirun", "nginx", "./entrypoint.sh"]

View File

@ -1,31 +0,0 @@
#!/bin/sh
set -ex
if [ ! -f /app/.env ]; then
php artisan key:generate --no-interaction --force
fi
php artisan migrate --no-interaction --force
echo "Setting folder permissions for uploads"
chown -R www-data:www-data public/uploads storage/uploads
php artisan cache:clear
php artisan view:clear
echo "Starting Nginx:"
nginx
echo "Getting PPM ready:"
trapIt() {
"$@" &
pid="$!"
trap 'kill -INT $pid' INT TERM
while kill -0 $pid >/dev/null 2>&1; do
wait $pid
ec="$?"
done
exit $ec
}
echo "Starting PPM:"
trapIt /ppm/vendor/bin/ppm start --ansi --no-interaction --config=ppm.json

13
app/entrypoint.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -ex
if [ ! -f .env ]; then
php artisan key:generate --no-interaction --force
fi
php artisan migrate --no-interaction --force
php artisan cache:clear
php artisan view:clear
echo "Starting PPM:"
/ppm/vendor/bin/ppm start --ansi --no-interaction --config=ppm.json

View File

@ -1,5 +1,5 @@
worker_processes auto; worker_processes auto;
pid /tmp/nginx.pid; pid /tmp/nginx.pid;
daemon on; daemon on;
events { events {

View File

@ -12,7 +12,7 @@ upload_max_filesize = 64M
expose_php=0 expose_php=0
session.save_handler = redis session.save_handler = redis
session.save_path = "tcp://redis:6379" session.save_path = "tcp://cache:6379?database=1"
opcache.enable=1 opcache.enable=1
opcache.enable_cli=1 opcache.enable_cli=1

View File

@ -1,10 +1,11 @@
version: '3.7' version: '3.7'
services: services:
db: db:
image: mariadb:10.4 image: mariadb:10.5
restart: unless-stopped restart: unless-stopped
environment: environment:
- TZ=${TZ} - TZ=${APP_TIMEZONE}
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASS} - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASS}
- MYSQL_DATABASE=${DB_DATABASE} - MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USERNAME} - MYSQL_USER=${DB_USERNAME}
@ -15,17 +16,18 @@ services:
- backend - backend
cache: cache:
image: redis:5-alpine image: redis:6-alpine
restart: unless-stopped restart: unless-stopped
environment: environment:
- TZ=${TZ} - TZ=${APP_TIMEZONE}
volumes: volumes:
- cache:/data/ - cache:/data/
networks: networks:
- backend - backend
app: app:
image: jjtc/bookstack-ppm:0.28.2-r2 image: jjtc/bookstack-ppm:0.31.6-r0
init: true
build: ./app/ build: ./app/
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
@ -48,7 +50,6 @@ services:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.bookstack.entrypoints=http" - "traefik.http.routers.bookstack.entrypoints=http"
- "traefik.http.routers.bookstack.rule=Host(`${APP_URL_BASE}`)" - "traefik.http.routers.bookstack.rule=Host(`${APP_URL_BASE}`)"
- "traefik.http.routers.bookstack.middlewares=redirect-https@file"
- "traefik.http.routers.bookstack-secure.entrypoints=https" - "traefik.http.routers.bookstack-secure.entrypoints=https"
- "traefik.http.routers.bookstack-secure.rule=Host(`${APP_URL_BASE}`)" - "traefik.http.routers.bookstack-secure.rule=Host(`${APP_URL_BASE}`)"
- "traefik.http.routers.bookstack-secure.tls=true" - "traefik.http.routers.bookstack-secure.tls=true"
@ -72,7 +73,7 @@ services:
# - "traefik.enable=false" # - "traefik.enable=false"
#traefik: #traefik:
# image: traefik:2.1 # image: traefik:2.4
# restart: unless-stopped # restart: unless-stopped
# security_opt: # security_opt:
# - no-new-privileges:true # - no-new-privileges:true

View File

@ -1,96 +0,0 @@
--- a/app/Http/Controllers/AttachmentController.php
+++ b/app/Http/Controllers/AttachmentController.php
@@ -37,7 +37,7 @@ class AttachmentController extends Controller
{
$this->validate($request, [
'uploaded_to' => 'required|integer|exists:pages,id',
- 'file' => 'required|file'
+ 'file' => 'required'
]);
$pageId = $request->get('uploaded_to');
@@ -66,7 +66,7 @@ class AttachmentController extends Controller
{
$this->validate($request, [
'uploaded_to' => 'required|integer|exists:pages,id',
- 'file' => 'required|file'
+ 'file' => 'required'
]);
$pageId = $request->get('uploaded_to');
--- a/app/Http/Controllers/BookshelfController.php
+++ b/app/Http/Controllers/BookshelfController.php
@@ -146,7 +146,7 @@ class BookshelfController extends Controller
$this->validate($request, [
'name' => 'required|string|max:255',
'description' => 'string|max:1000',
- 'image' => $this->imageRepo->getImageValidationRules(),
+ 'image' => $this->getImageValidationRules(),
]);
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -195,6 +195,6 @@ abstract class Controller extends BaseController
*/
protected function getImageValidationRules(): string
{
- return 'image_extension|no_double_extension|mimes:jpeg,png,gif,bmp,webp,tiff';
+ return 'nullable|image_extension|no_double_extension';
}
}
--- a/app/Http/Controllers/SettingController.php
+++ b/app/Http/Controllers/SettingController.php
@@ -44,7 +44,7 @@ class SettingController extends Controller
$this->preventAccessInDemoMode();
$this->checkPermission('settings-manage');
$this->validate($request, [
- 'app_logo' => $this->imageRepo->getImageValidationRules(),
+ 'app_logo' => $this->getImageValidationRules(),
]);
// Cycles through posted settings and update them
@@ -57,7 +57,7 @@ class SettingController extends Controller
}
// Update logo image if set
- if ($request->has('app_logo')) {
+ if ($request->has('app_logo') && !$request->has('app_logo_reset') && !$request->has('setting-app-logo')) {
$logoFile = $request->file('app_logo');
$this->imageRepo->destroyByType('system');
$image = $this->imageRepo->saveNew($logoFile, 'system', 0, null, 86);
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -155,7 +155,7 @@ class UserController extends Controller
'password' => 'min:6|required_with:password_confirm',
'password-confirm' => 'same:password|required_with:password',
'setting' => 'array',
- 'profile_image' => $this->imageRepo->getImageValidationRules(),
+ 'profile_image' => $this->getImageValidationRules(),
]);
$user = $this->userRepo->getById($id);
@@ -191,7 +191,7 @@ class UserController extends Controller
}
// Save profile image if in request
- if ($request->has('profile_image')) {
+ if ($request->has('profile_image') && !$request->has('profile_image_reset')) {
$imageUpload = $request->file('profile_image');
$this->imageRepo->destroyImage($user->avatar);
$image = $this->imageRepo->saveNew($imageUpload, 'user', $user->id);
--- a/app/Uploads/ImageRepo.php
+++ b/app/Uploads/ImageRepo.php
@@ -225,6 +225,6 @@ class ImageRepo
*/
public function getImageValidationRules(): string
{
- return 'image_extension|no_double_extension|mimes:jpeg,png,gif,bmp,webp,tiff';
+ return 'image_extension|no_double_extension';
}
}