mirror of
https://github.com/wallabag/docker
synced 2025-12-13 17:56:31 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ee10895d8 |
57
.github/workflows/publish.yml
vendored
57
.github/workflows/publish.yml
vendored
@@ -1,57 +0,0 @@
|
|||||||
name: Publish Docker image
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
push_to_registries:
|
|
||||||
name: Push Docker image to multiple registries
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
contents: read
|
|
||||||
steps:
|
|
||||||
- name: Check out the repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# Documentation: https://github.com/docker/setup-qemu-action
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
# Documentation: https://github.com/docker/setup-buildx-action
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
wallabag/wallabag
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push Docker images
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
# Support for different platforms, see here:
|
|
||||||
# https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-set-the-target-platforms-for-the-build---platform
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
29
.github/workflows/test.yml
vendored
29
.github/workflows/test.yml
vendored
@@ -24,28 +24,31 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout"
|
- name: "Checkout"
|
||||||
uses: actions/checkout@v3
|
uses: "actions/checkout@v2"
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.5
|
||||||
|
|
||||||
- name: "Build image"
|
- name: "Build image"
|
||||||
run: docker-compose -f tests/docker-compose.${{ matrix.database }}.yml build
|
run: docker-compose -f tests/docker-compose.${{ matrix.database }}.yml build
|
||||||
|
|
||||||
|
- name: "Run image"
|
||||||
|
run: docker-compose -f tests/docker-compose.${{ matrix.database }}.yml up -d
|
||||||
|
|
||||||
- name: "Install dependencies"
|
- name: "Install dependencies"
|
||||||
run: pip install pytest pytest-docker requests
|
run: |
|
||||||
|
pip install pytest
|
||||||
|
pip install requests
|
||||||
|
|
||||||
|
- name: "Check running instance"
|
||||||
|
run: docker ps
|
||||||
|
|
||||||
|
- name: "Wait 60s"
|
||||||
|
run: sleep 60
|
||||||
|
|
||||||
- name: "Run tests"
|
- name: "Run tests"
|
||||||
run: py.test --database=${{ matrix.database }} tests/
|
run: py.test tests/
|
||||||
|
|
||||||
- name: "Get docker logs"
|
|
||||||
if: ${{ always() }}
|
|
||||||
run: docker-compose -p "wallabag_${{ matrix.database }}" -f tests/docker-compose.${{ matrix.database }}.yml logs wallabag
|
|
||||||
|
|
||||||
- name: "Cleanup environment"
|
|
||||||
if: ${{ always() }}
|
|
||||||
run: docker-compose -p "wallabag_${{ matrix.database }}" -f tests/docker-compose.${{ matrix.database }}.yml down -v
|
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,2 @@
|
|||||||
.cache
|
/patches/*
|
||||||
__pycache__/*
|
!/patches/.keep
|
||||||
*.pyc
|
|
||||||
|
|||||||
152
Dockerfile
152
Dockerfile
@@ -1,81 +1,89 @@
|
|||||||
FROM golang:alpine as builder
|
FROM php:7.4.14-fpm-alpine
|
||||||
|
|
||||||
# envsubst from gettext can not replace env vars with default values
|
ARG BASE=2.4.2
|
||||||
# this package is not available for ARM32 and we have to build it from source code
|
|
||||||
# flag -ldflags "-s -w" produces a smaller executable
|
|
||||||
RUN go install -ldflags "-s -w" -v github.com/a8m/envsubst/cmd/envsubst@v1.3.0
|
|
||||||
|
|
||||||
FROM alpine:3.18
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
COPY --from=builder /go/bin/envsubst /usr/bin/envsubst
|
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
|
||||||
|
ENV SYMFONY_ENV=prod
|
||||||
|
|
||||||
ARG WALLABAG_VERSION=2.6.2
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
apk add --no-cache --virtual .run-deps \
|
||||||
|
gnu-libiconv=1.15-r3 \
|
||||||
|
imagemagick6-libs \
|
||||||
|
tzdata \
|
||||||
|
; \
|
||||||
|
apk add --no-cache --virtual .build-deps \
|
||||||
|
$PHPIZE_DEPS \
|
||||||
|
freetype-dev \
|
||||||
|
gettext-dev \
|
||||||
|
icu-dev \
|
||||||
|
imagemagick6-dev \
|
||||||
|
libjpeg-turbo-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libzip-dev \
|
||||||
|
oniguruma-dev \
|
||||||
|
postgresql-dev \
|
||||||
|
sqlite-dev \
|
||||||
|
tidyhtml-dev \
|
||||||
|
; \
|
||||||
|
docker-php-ext-configure gd --with-freetype --with-jpeg; \
|
||||||
|
docker-php-ext-install -j "$(nproc)" \
|
||||||
|
bcmath \
|
||||||
|
gd \
|
||||||
|
gettext \
|
||||||
|
iconv \
|
||||||
|
intl \
|
||||||
|
mbstring \
|
||||||
|
opcache \
|
||||||
|
pdo \
|
||||||
|
pdo_mysql \
|
||||||
|
pdo_pgsql \
|
||||||
|
pdo_sqlite \
|
||||||
|
sockets \
|
||||||
|
tidy \
|
||||||
|
zip \
|
||||||
|
; \
|
||||||
|
pecl install redis; \
|
||||||
|
pecl install imagick; \
|
||||||
|
docker-php-ext-enable \
|
||||||
|
redis \
|
||||||
|
imagick \
|
||||||
|
; \
|
||||||
|
runDeps="$( \
|
||||||
|
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||||
|
| tr ',' '\n' \
|
||||||
|
| sort -u \
|
||||||
|
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||||
|
)"; \
|
||||||
|
apk add --virtual .wallabag-phpext-rundeps $runDeps; \
|
||||||
|
apk del .build-deps \
|
||||||
|
; \
|
||||||
|
apk add --virtual .composer-runtime-deps git patch; \
|
||||||
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer; \
|
||||||
|
rm -rf /usr/src/* /tmp/pear/*
|
||||||
|
|
||||||
RUN set -ex \
|
RUN wget -O /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m`; \
|
||||||
&& apk add --no-cache \
|
chmod +x /usr/local/bin/envsubst
|
||||||
curl \
|
|
||||||
libwebp \
|
|
||||||
nginx \
|
|
||||||
pcre \
|
|
||||||
php81 \
|
|
||||||
php81-bcmath \
|
|
||||||
php81-ctype \
|
|
||||||
php81-curl \
|
|
||||||
php81-dom \
|
|
||||||
php81-fpm \
|
|
||||||
php81-gd \
|
|
||||||
php81-gettext \
|
|
||||||
php81-iconv \
|
|
||||||
php81-json \
|
|
||||||
php81-mbstring \
|
|
||||||
php81-openssl \
|
|
||||||
php81-pecl-amqp \
|
|
||||||
php81-pdo_mysql \
|
|
||||||
php81-pdo_pgsql \
|
|
||||||
php81-pdo_sqlite \
|
|
||||||
php81-phar \
|
|
||||||
php81-session \
|
|
||||||
php81-simplexml \
|
|
||||||
php81-tokenizer \
|
|
||||||
php81-xml \
|
|
||||||
php81-zlib \
|
|
||||||
php81-sockets \
|
|
||||||
php81-xmlreader \
|
|
||||||
php81-tidy \
|
|
||||||
php81-intl \
|
|
||||||
php81-sodium \
|
|
||||||
mariadb-client \
|
|
||||||
postgresql14-client \
|
|
||||||
rabbitmq-c \
|
|
||||||
s6 \
|
|
||||||
tar \
|
|
||||||
tzdata \
|
|
||||||
&& ln -sf /usr/bin/php81 /usr/bin/php \
|
|
||||||
&& ln -sf /usr/sbin/php-fpm81 /usr/sbin/php-fpm \
|
|
||||||
&& rm -rf /var/cache/apk/* \
|
|
||||||
&& ln -sf /dev/stdout /var/log/nginx/access.log \
|
|
||||||
&& ln -sf /dev/stderr /var/log/nginx/error.log \
|
|
||||||
&& curl -s https://getcomposer.org/installer | php \
|
|
||||||
&& mv composer.phar /usr/local/bin/composer \
|
|
||||||
&& rm -rf /root/.composer/*
|
|
||||||
|
|
||||||
COPY root /
|
RUN wget -O /tmp/wallabag.tar.gz https://github.com/wallabag/wallabag/archive/$BASE.tar.gz; \
|
||||||
|
mkdir /tmp/extract; \
|
||||||
|
tar xf /tmp/wallabag.tar.gz -C /tmp/extract; \
|
||||||
|
rmdir /var/www/html; \
|
||||||
|
mv /tmp/extract/wallabag-*/ /var/www/html; \
|
||||||
|
cd /var/www/html; \
|
||||||
|
composer install --no-dev --no-interaction -o --prefer-dist; \
|
||||||
|
chown -R www-data: /var/www/html; \
|
||||||
|
rm -rf /tmp/wallabag.tar.gz /tmp/extract /root/.composer /var/www/html/var/cache/prod;
|
||||||
|
|
||||||
RUN set -ex \
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
&& curl -L -o /tmp/wallabag.tar.gz https://github.com/wallabag/wallabag/archive/$WALLABAG_VERSION.tar.gz \
|
COPY config/ /opt/wallabag/config/
|
||||||
&& tar xvf /tmp/wallabag.tar.gz -C /tmp \
|
COPY patches/ /opt/wallabag/patches/
|
||||||
&& mkdir /var/www/wallabag \
|
COPY apply-patches.sh /opt/wallabag/apply-patches.sh
|
||||||
&& mv /tmp/wallabag-*/* /var/www/wallabag/ \
|
RUN set -ex; \
|
||||||
&& rm -rf /tmp/wallabag* \
|
/opt/wallabag/apply-patches.sh
|
||||||
&& cd /var/www/wallabag \
|
|
||||||
&& mkdir data/assets \
|
|
||||||
&& envsubst < /etc/wallabag/parameters.template.yml > app/config/parameters.yml \
|
|
||||||
&& SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist --no-progress \
|
|
||||||
&& rm -rf /root/.composer/* /var/www/wallabag/var/cache/* /var/www/wallabag/var/logs/* /var/www/wallabag/var/sessions/* \
|
|
||||||
&& chown -R nobody:nobody /var/www/wallabag
|
|
||||||
|
|
||||||
ENV PATH="${PATH}:/var/www/wallabag/bin"
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["wallabag"]
|
CMD ["php-fpm"]
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -24,15 +24,17 @@ Default login is `wallabag:wallabag`.
|
|||||||
- `-e SYMFONY__ENV__DATABASE_USER=...` (defaults to "root", this is the name of the database user to use)
|
- `-e SYMFONY__ENV__DATABASE_USER=...` (defaults to "root", this is the name of the database user to use)
|
||||||
- `-e SYMFONY__ENV__DATABASE_PASSWORD=...` (defaults to "~", this is the password of the database user to use)
|
- `-e SYMFONY__ENV__DATABASE_PASSWORD=...` (defaults to "~", this is the password of the database user to use)
|
||||||
- `-e SYMFONY__ENV__DATABASE_CHARSET=...` (defaults to utf8, this is the database charset to use)
|
- `-e SYMFONY__ENV__DATABASE_CHARSET=...` (defaults to utf8, this is the database charset to use)
|
||||||
- `-e SYMFONY__ENV__DATABASE_TABLE_PREFIX=...` (defaults to "wallabag_". Specifies the prefix for each database table)
|
|
||||||
- `-e SYMFONY__ENV__SECRET=...` (defaults to "ovmpmAWXRCabNlMgzlzFXDYmCFfzGv")
|
- `-e SYMFONY__ENV__SECRET=...` (defaults to "ovmpmAWXRCabNlMgzlzFXDYmCFfzGv")
|
||||||
- `-e SYMFONY__ENV__LOCALE=...` (default to en)
|
- `-e SYMFONY__ENV__LOCALE=...` (default to en)
|
||||||
- `-e SYMFONY__ENV__MAILER_DSN=...` (defaults to "smtp://127.0.0.1")
|
- `-e SYMFONY__ENV__MAILER_HOST=...` (defaults to "127.0.0.1", the SMTP host)
|
||||||
|
- `-e SYMFONY__ENV__MAILER_USER=...` (defaults to "~", the SMTP user)
|
||||||
|
- `-e SYMFONY__ENV__MAILER_PASSWORD=...`(defaults to "~", the SMTP password)
|
||||||
- `-e SYMFONY__ENV__FROM_EMAIL=...`(defaults to "`wallabag@example.com`", the address wallabag uses for outgoing emails)
|
- `-e SYMFONY__ENV__FROM_EMAIL=...`(defaults to "`wallabag@example.com`", the address wallabag uses for outgoing emails)
|
||||||
|
- `-e SYMFONY__ENV__TWOFACTOR_AUTH=...` (defaults to "true", enable or disable two-factor authentication)
|
||||||
- `-e SYMFONY__ENV__TWOFACTOR_SENDER=...` (defaults to "`no-reply@wallabag.org`", the address wallabag uses for two-factor emails)
|
- `-e SYMFONY__ENV__TWOFACTOR_SENDER=...` (defaults to "`no-reply@wallabag.org`", the address wallabag uses for two-factor emails)
|
||||||
- `-e SYMFONY__ENV__FOSUSER_REGISTRATION=...`(defaults to "true", enable or disable public user registration)
|
- `-e SYMFONY__ENV__FOSUSER_REGISTRATION=...`(defaults to "true", enable or disable public user registration)
|
||||||
- `-e SYMFONY__ENV__FOSUSER_CONFIRMATION=...`(defaults to "true", enable or disable registration confirmation)
|
- `-e SYMFONY__ENV__FOSUSER_CONFIRMATION=...`(defaults to "true", enable or disable registration confirmation)
|
||||||
- `-e SYMFONY__ENV__DOMAIN_NAME=...` defaults to "`https://your-wallabag-instance.wallabag.org`", the URL of your wallabag instance)
|
- `-e SYMFONY__ENV__DOMAIN_NAME=...` defaults to "`https://your-wallabag-url-instance.com`", the URL of your wallabag instance)
|
||||||
- `-e SYMFONY__ENV__REDIS_SCHEME=...` (defaults to "tcp", protocol to use to communicate with the target server (tcp, unix, or http))
|
- `-e SYMFONY__ENV__REDIS_SCHEME=...` (defaults to "tcp", protocol to use to communicate with the target server (tcp, unix, or http))
|
||||||
- `-e SYMFONY__ENV__REDIS_HOST=...` (defaults to "redis", IP or hostname of the target server)
|
- `-e SYMFONY__ENV__REDIS_HOST=...` (defaults to "redis", IP or hostname of the target server)
|
||||||
- `-e SYMFONY__ENV__REDIS_PORT=...` (defaults to "6379", port of the target host)
|
- `-e SYMFONY__ENV__REDIS_PORT=...` (defaults to "6379", port of the target host)
|
||||||
@@ -105,7 +107,7 @@ $ docker exec -t NAME_OR_ID_OF_YOUR_WALLABAG_CONTAINER /var/www/wallabag/bin/con
|
|||||||
|
|
||||||
## docker-compose
|
## docker-compose
|
||||||
|
|
||||||
An example [docker-compose](https://docs.docker.com/compose/) file can be seen below:
|
It's a good way to use [docker-compose](https://docs.docker.com/compose/). Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
version: '3'
|
version: '3'
|
||||||
@@ -121,38 +123,24 @@ services:
|
|||||||
- SYMFONY__ENV__DATABASE_USER=wallabag
|
- SYMFONY__ENV__DATABASE_USER=wallabag
|
||||||
- SYMFONY__ENV__DATABASE_PASSWORD=wallapass
|
- SYMFONY__ENV__DATABASE_PASSWORD=wallapass
|
||||||
- SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
|
- SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
|
||||||
- SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
|
- SYMFONY__ENV__MAILER_HOST=127.0.0.1
|
||||||
- SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1
|
- SYMFONY__ENV__MAILER_USER=~
|
||||||
|
- SYMFONY__ENV__MAILER_PASSWORD=~
|
||||||
- SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
|
- SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
|
||||||
- SYMFONY__ENV__DOMAIN_NAME=https://your-wallabag-instance.wallabag.org
|
- SYMFONY__ENV__DOMAIN_NAME=https://your-wallabag-url-instance.com
|
||||||
- SYMFONY__ENV__SERVER_NAME="Your wallabag instance"
|
- SYMFONY__ENV__SERVER_NAME="Your wallabag instance"
|
||||||
ports:
|
ports:
|
||||||
- "80"
|
- "80"
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/wallabag/images:/var/www/wallabag/web/assets/images
|
- /opt/wallabag/images:/var/www/wallabag/web/assets/images
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost"]
|
|
||||||
interval: 1m
|
|
||||||
timeout: 3s
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
- redis
|
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=wallaroot
|
- MYSQL_ROOT_PASSWORD=wallaroot
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/wallabag/data:/var/lib/mysql
|
- /opt/wallabag/data:/var/lib/mysql
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
|
|
||||||
interval: 20s
|
|
||||||
timeout: 3s
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
|
||||||
interval: 20s
|
|
||||||
timeout: 3s
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that you must fill out the mail related variables according to your mail config.
|
Note that you must fill out the mail related variables according to your mail config.
|
||||||
|
|||||||
5
apply-patches.sh
Executable file
5
apply-patches.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for i in $(find /opt/wallabag/patches/ -type f -name "*.patch" | sort); do
|
||||||
|
(cd /var/www/html ; echo "Applying ${i}…" ; patch -p1 < ${i})
|
||||||
|
done
|
||||||
@@ -1,37 +1,44 @@
|
|||||||
parameters:
|
parameters:
|
||||||
database_driver: ${SYMFONY__ENV__DATABASE_DRIVER:-pdo_sqlite}
|
database_driver: ${SYMFONY__ENV__DATABASE_DRIVER:-pdo_sqlite}
|
||||||
|
database_driver_class: ${SYMFONY__ENV__DATABASE_DRIVER_CLASS:-~}
|
||||||
database_host: ${SYMFONY__ENV__DATABASE_HOST:-127.0.0.1}
|
database_host: ${SYMFONY__ENV__DATABASE_HOST:-127.0.0.1}
|
||||||
database_port: ${SYMFONY__ENV__DATABASE_PORT:-~}
|
database_port: ${SYMFONY__ENV__DATABASE_PORT:-~}
|
||||||
database_name: ${SYMFONY__ENV__DATABASE_NAME:-symfony}
|
database_name: ${SYMFONY__ENV__DATABASE_NAME:-symfony}
|
||||||
database_user: ${SYMFONY__ENV__DATABASE_USER:-root}
|
database_user: ${SYMFONY__ENV__DATABASE_USER:-root}
|
||||||
database_password: ${SYMFONY__ENV__DATABASE_PASSWORD:-~}
|
database_password: ${SYMFONY__ENV__DATABASE_PASSWORD:-~}
|
||||||
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
|
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
|
||||||
database_table_prefix: ${SYMFONY__ENV__DATABASE_TABLE_PREFIX:-wallabag_}
|
database_table_prefix: wallabag_
|
||||||
database_socket: null
|
database_socket: null
|
||||||
database_charset: ${SYMFONY__ENV__DATABASE_CHARSET:-utf8}
|
database_charset: ${SYMFONY__ENV__DATABASE_CHARSET:-utf8}
|
||||||
|
|
||||||
domain_name: ${SYMFONY__ENV__DOMAIN_NAME:-https://your-wallabag-instance.wallabag.org}
|
domain_name: ${SYMFONY__ENV__DOMAIN_NAME:-https://your-wallabag-url-instance.com}
|
||||||
|
server_name: ${SYMFONY__ENV__SERVER_NAME:-"Your wallabag instance"}
|
||||||
|
|
||||||
mailer_dsn: ${SYMFONY__ENV__MAILER_DSN:-smtp://127.0.0.1}
|
mailer_transport: ${SYMFONY__ENV__MAILER_TRANSPORT:-smtp}
|
||||||
|
mailer_user: ${SYMFONY__ENV__MAILER_USER:-~}
|
||||||
|
mailer_password: ${SYMFONY__ENV__MAILER_PASSWORD:-~}
|
||||||
|
mailer_host: ${SYMFONY__ENV__MAILER_HOST:-127.0.0.1}
|
||||||
|
mailer_port: ${SYMFONY__ENV__MAILER_PORT:-25}
|
||||||
|
mailer_encryption: ${SYMFONY__ENV__MAILER_ENCRYPTION:-~}
|
||||||
|
mailer_auth_mode: ${SYMFONY__ENV__MAILER_AUTH_MODE:-~}
|
||||||
|
|
||||||
locale: ${SYMFONY__ENV__LOCALE:-en}
|
locale: ${SYMFONY__ENV__LOCALE:-en}
|
||||||
|
|
||||||
# A secret key that's used to generate certain security-related tokens
|
# A secret key that's used to generate certain security-related tokens
|
||||||
secret: ${SYMFONY__ENV__SECRET:-ovmpmAWXRCabNlMgzlzFXDYmCFfzGv}
|
secret: ${SYMFONY__ENV__SECRET:-~}
|
||||||
|
|
||||||
# two factor stuff
|
# two factor stuff
|
||||||
|
twofactor_auth: ${SYMFONY__ENV__TWOFACTOR_AUTH:-true}
|
||||||
twofactor_sender: ${SYMFONY__ENV__TWOFACTOR_SENDER:-no-reply@wallabag.org}
|
twofactor_sender: ${SYMFONY__ENV__TWOFACTOR_SENDER:-no-reply@wallabag.org}
|
||||||
|
|
||||||
# fosuser stuff
|
# fosuser stuff
|
||||||
fosuser_registration: ${SYMFONY__ENV__FOSUSER_REGISTRATION:-true}
|
fosuser_registration: ${SYMFONY__ENV__FOSUSER_REGISTRATION:-true}
|
||||||
fosuser_confirmation: ${SYMFONY__ENV__FOSUSER_CONFIRMATION:-true}
|
fosuser_confirmation: ${SYMFONY__ENV__FOSUSER_CONFIRMATION:-true}
|
||||||
|
|
||||||
# how long the access token should live in seconds for the API
|
|
||||||
fos_oauth_server_access_token_lifetime: 3600
|
fos_oauth_server_access_token_lifetime: 3600
|
||||||
# how long the refresh token should life in seconds for the API
|
|
||||||
fos_oauth_server_refresh_token_lifetime: 1209600
|
fos_oauth_server_refresh_token_lifetime: 1209600
|
||||||
|
|
||||||
from_email: ${SYMFONY__ENV__FROM_EMAIL:-no-reply@wallabag.org}
|
from_email: ${SYMFONY__ENV__FROM_EMAIL:-wallabag@example.com}
|
||||||
|
|
||||||
rss_limit: 50
|
rss_limit: 50
|
||||||
|
|
||||||
@@ -52,5 +59,4 @@ parameters:
|
|||||||
# Sentry
|
# Sentry
|
||||||
sentry_dsn: ${SYMFONY__ENV__SENTRY_DSN:-~}
|
sentry_dsn: ${SYMFONY__ENV__SENTRY_DSN:-~}
|
||||||
|
|
||||||
# User-friendly name of your instance for 2FA issuer
|
session_handler: ${SESSION_HANDLER:-session.handler.native_file}
|
||||||
server_name: ${SYMFONY__ENV__SERVER_NAME:-"Your wallabag instance"}
|
|
||||||
17
config/wallabag-php.ini
Normal file
17
config/wallabag-php.ini
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
memory_limit = ${PHP_MEMORY_LIMIT:-512M}
|
||||||
|
|
||||||
|
max_execution_time = ${PHP_MAX_EXECUTION_TIME:-60}
|
||||||
|
|
||||||
|
date.time = ${PHP_TIMEZONE:-Europe/Paris}
|
||||||
|
|
||||||
|
display_errors = off
|
||||||
|
|
||||||
|
session.save_handler = redis
|
||||||
|
session.save_path = "tcp://${PHP_SESSION_REDIS_HOST}:6379?database=2"
|
||||||
|
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=10000
|
||||||
|
opcache.memory_consumption=128
|
||||||
|
opcache.save_comments=1
|
||||||
|
opcache.revalidate_freq=1
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
import pytest
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
|
||||||
parser.addoption("--database", action="store", default="default")
|
|
||||||
6
entrypoint.sh
Executable file
6
entrypoint.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
envsubst < /opt/wallabag/config/wallabag-php.ini > /usr/local/etc/php/conf.d/wallabag-php.ini
|
||||||
|
envsubst < /opt/wallabag/config/parameters.yml > /var/www/html/app/config/parameters.yml
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
0
patches/.keep
Normal file
0
patches/.keep
Normal file
@@ -1,107 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Exit when any command fails
|
|
||||||
set -e
|
|
||||||
|
|
||||||
COMMAND_ARG1="$1"
|
|
||||||
COMMAND_ARG2="$2"
|
|
||||||
|
|
||||||
cd /var/www/wallabag || exit
|
|
||||||
|
|
||||||
wait_for_database() {
|
|
||||||
timeout 60s /bin/sh -c "$(cat << EOF
|
|
||||||
until echo 'Waiting for database ...' \
|
|
||||||
&& nc -z ${SYMFONY__ENV__DATABASE_HOST} ${SYMFONY__ENV__DATABASE_PORT} < /dev/null > /dev/null 2>&1 ; \
|
|
||||||
do sleep 1 ; done
|
|
||||||
EOF
|
|
||||||
)"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_wallabag() {
|
|
||||||
su -c "php bin/console wallabag:install --env=prod -n" -s /bin/sh nobody
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner() {
|
|
||||||
SYMFONY__ENV__DATABASE_DRIVER=${SYMFONY__ENV__DATABASE_DRIVER:-pdo_sqlite}
|
|
||||||
POPULATE_DATABASE=${POPULATE_DATABASE:-True}
|
|
||||||
|
|
||||||
# Replace environment variables
|
|
||||||
envsubst < /etc/wallabag/parameters.template.yml > app/config/parameters.yml
|
|
||||||
|
|
||||||
# Wait for external database
|
|
||||||
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_mysql" ] || [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] ; then
|
|
||||||
wait_for_database
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure SQLite database
|
|
||||||
SQLITE_FILE_SIZE=$(wc -c "/var/www/wallabag/data/db/wallabag.sqlite" | awk '{print $1}')
|
|
||||||
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_sqlite" ] && ([ ! -f "/var/www/wallabag/data/db/wallabag.sqlite" ] || [ "$SQLITE_FILE_SIZE" = 0 ]) ; then
|
|
||||||
echo "Configuring the SQLite database ..."
|
|
||||||
install_wallabag
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure MySQL / MariaDB database
|
|
||||||
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_mysql" ] && [ "$POPULATE_DATABASE" = "True" ] && [ "$MYSQL_ROOT_PASSWORD" != "" ] ; then
|
|
||||||
DATABASE_EXISTS="$(mysql -h "${SYMFONY__ENV__DATABASE_HOST}" --port "${SYMFONY__ENV__DATABASE_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" \
|
|
||||||
-sse "SELECT EXISTS(SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$SYMFONY__ENV__DATABASE_NAME')")"
|
|
||||||
if [ "$DATABASE_EXISTS" != "1" ]; then
|
|
||||||
echo "Configuring the MySQL database ..."
|
|
||||||
mysql -h "${SYMFONY__ENV__DATABASE_HOST}" --port "${SYMFONY__ENV__DATABASE_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" \
|
|
||||||
-e "CREATE DATABASE IF NOT EXISTS ${SYMFONY__ENV__DATABASE_NAME} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
|
||||||
USER_EXISTS="$(mysql -h "${SYMFONY__ENV__DATABASE_HOST}" --port "${SYMFONY__ENV__DATABASE_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" \
|
|
||||||
-sse "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = '$SYMFONY__ENV__DATABASE_USER')")"
|
|
||||||
if [ "$USER_EXISTS" != "1" ]; then
|
|
||||||
mysql -h "${SYMFONY__ENV__DATABASE_HOST}" --port "${SYMFONY__ENV__DATABASE_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" \
|
|
||||||
-e "CREATE USER IF NOT EXISTS '${SYMFONY__ENV__DATABASE_USER}'@'%' IDENTIFIED BY '${SYMFONY__ENV__DATABASE_PASSWORD}';"
|
|
||||||
mysql -h "${SYMFONY__ENV__DATABASE_HOST}" --port "${SYMFONY__ENV__DATABASE_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" \
|
|
||||||
-e "GRANT ALL PRIVILEGES ON ${SYMFONY__ENV__DATABASE_NAME}.* TO '${SYMFONY__ENV__DATABASE_USER}'@'%';"
|
|
||||||
fi
|
|
||||||
install_wallabag
|
|
||||||
else
|
|
||||||
echo "WARN: MySQL database is already configured. Remove the environment variable with root password."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure Postgres database
|
|
||||||
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] && [ "$POPULATE_DATABASE" = "True" ] && [ "$POSTGRES_PASSWORD" != "" ] ; then
|
|
||||||
export PGPASSWORD="${POSTGRES_PASSWORD}"
|
|
||||||
DATABASE_EXISTS="$(psql -qAt -h "${SYMFONY__ENV__DATABASE_HOST}" -p "${SYMFONY__ENV__DATABASE_PORT}" -U "${POSTGRES_USER}" \
|
|
||||||
-c "SELECT 1 FROM pg_catalog.pg_database WHERE datname = '${SYMFONY__ENV__DATABASE_NAME}';")"
|
|
||||||
if [ "$DATABASE_EXISTS" != "1" ]; then
|
|
||||||
echo "Configuring the Postgres database ..."
|
|
||||||
psql -q -h "${SYMFONY__ENV__DATABASE_HOST}" -p "${SYMFONY__ENV__DATABASE_PORT}" -U "${POSTGRES_USER}" \
|
|
||||||
-c "CREATE DATABASE ${SYMFONY__ENV__DATABASE_NAME};"
|
|
||||||
USER_EXISTS="$(psql -qAt -h "${SYMFONY__ENV__DATABASE_HOST}" -p "${SYMFONY__ENV__DATABASE_PORT}" -U "${POSTGRES_USER}" \
|
|
||||||
-c "SELECT 1 FROM pg_roles WHERE rolname = '${SYMFONY__ENV__DATABASE_USER}';")"
|
|
||||||
if [ "$USER_EXISTS" != "1" ]; then
|
|
||||||
psql -q -h "${SYMFONY__ENV__DATABASE_HOST}" -p "${SYMFONY__ENV__DATABASE_PORT}" -U "${POSTGRES_USER}" \
|
|
||||||
-c "CREATE ROLE ${SYMFONY__ENV__DATABASE_USER} with PASSWORD '${SYMFONY__ENV__DATABASE_PASSWORD}' LOGIN;"
|
|
||||||
fi
|
|
||||||
install_wallabag
|
|
||||||
else
|
|
||||||
echo "WARN: Postgres database is already configured. Remove the environment variable with root password."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove cache and install Wallabag
|
|
||||||
rm -f -r /var/www/wallabag/var/cache
|
|
||||||
su -c "SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist" -s /bin/sh nobody
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$COMMAND_ARG1" = "wallabag" ]; then
|
|
||||||
echo "Starting wallabag ..."
|
|
||||||
provisioner
|
|
||||||
echo "wallabag is ready!"
|
|
||||||
exec s6-svscan /etc/s6/
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$COMMAND_ARG1" = "import" ]; then
|
|
||||||
provisioner
|
|
||||||
exec su -c "bin/console wallabag:import:redis-worker --env=prod $COMMAND_ARG2 -vv" -s /bin/sh nobody
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$COMMAND_ARG1" = "migrate" ]; then
|
|
||||||
provisioner
|
|
||||||
exec su -c "bin/console doctrine:migrations:migrate --env=prod --no-interaction" -s /bin/sh nobody
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
fastcgi_param QUERY_STRING $query_string;
|
|
||||||
fastcgi_param REQUEST_METHOD $request_method;
|
|
||||||
fastcgi_param CONTENT_TYPE $content_type;
|
|
||||||
fastcgi_param CONTENT_LENGTH $content_length;
|
|
||||||
|
|
||||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
||||||
fastcgi_param REQUEST_URI $request_uri;
|
|
||||||
fastcgi_param DOCUMENT_URI $document_uri;
|
|
||||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
|
||||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
|
||||||
fastcgi_param REQUEST_SCHEME $scheme;
|
|
||||||
fastcgi_param HTTPS $fe_https;
|
|
||||||
|
|
||||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
|
||||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
|
||||||
|
|
||||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
|
||||||
fastcgi_param REMOTE_PORT $remote_port;
|
|
||||||
fastcgi_param SERVER_ADDR $server_addr;
|
|
||||||
fastcgi_param SERVER_PORT $server_port;
|
|
||||||
fastcgi_param SERVER_NAME $server_name;
|
|
||||||
|
|
||||||
# PHP only, required if PHP was built with --enable-force-cgi-redirect
|
|
||||||
fastcgi_param REDIRECT_STATUS 200;
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
user nginx;
|
|
||||||
worker_processes 1;
|
|
||||||
pid /var/run/nginx.pid;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 2048;
|
|
||||||
multi_accept on;
|
|
||||||
use epoll;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
|
|
||||||
server_tokens off;
|
|
||||||
sendfile on;
|
|
||||||
tcp_nopush on;
|
|
||||||
tcp_nodelay on;
|
|
||||||
keepalive_timeout 15;
|
|
||||||
types_hash_max_size 2048;
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
access_log off;
|
|
||||||
error_log off;
|
|
||||||
gzip on;
|
|
||||||
gzip_disable "msie6";
|
|
||||||
open_file_cache max=100;
|
|
||||||
client_max_body_size 100M;
|
|
||||||
|
|
||||||
map $http_x_forwarded_proto $fe_https {
|
|
||||||
default $https;
|
|
||||||
https on;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream php-upstream {
|
|
||||||
server 127.0.0.1:9000;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
root /var/www/wallabag/web;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
# try to serve file directly, fallback to app.php
|
|
||||||
try_files $uri /app.php$is_args$args;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ ^/app\.php(/|$) {
|
|
||||||
fastcgi_pass php-upstream;
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
|
||||||
include fastcgi_params;
|
|
||||||
# When you are using symlinks to link the document root to the
|
|
||||||
# current version of your application, you should pass the real
|
|
||||||
# application path instead of the path to the symlink to PHP
|
|
||||||
# FPM.
|
|
||||||
# Otherwise, PHP's OPcache may not properly detect changes to
|
|
||||||
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
|
|
||||||
# for more information).
|
|
||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
||||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
|
||||||
# Prevents URIs that include the front controller. This will 404:
|
|
||||||
# http://domain.tld/app.php/some-path
|
|
||||||
# Remove the internal directive to allow URIs like this
|
|
||||||
internal;
|
|
||||||
}
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log;
|
|
||||||
error_log /var/log/nginx/error.log;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
daemon off;
|
|
||||||
@@ -1,537 +0,0 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; FPM Configuration ;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
; All relative paths in this configuration file are relative to PHP's install
|
|
||||||
; prefix (/usr). This prefix can be dynamically changed by using the
|
|
||||||
; '-p' argument from the command line.
|
|
||||||
|
|
||||||
; Include one or more files. If glob(3) exists, it is used to include a bunch of
|
|
||||||
; files from a glob(3) pattern. This directive can be used everywhere in the
|
|
||||||
; file.
|
|
||||||
; Relative path can also be used. They will be prefixed by:
|
|
||||||
; - the global prefix if it's been set (-p argument)
|
|
||||||
; - /usr otherwise
|
|
||||||
;include=etc/fpm.d/*.conf
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
|
||||||
; Global Options ;
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
[global]
|
|
||||||
; Pid file
|
|
||||||
; Note: the default prefix is /var
|
|
||||||
; Default Value: none
|
|
||||||
;pid = run/php-fpm.pid
|
|
||||||
|
|
||||||
; Error log file
|
|
||||||
; If it's set to "syslog", log is sent to syslogd instead of being written
|
|
||||||
; in a local file.
|
|
||||||
; Note: the default prefix is /var
|
|
||||||
; Default Value: log/php-fpm.log
|
|
||||||
error_log = /var/log/php-fpm.log
|
|
||||||
|
|
||||||
; syslog_facility is used to specify what type of program is logging the
|
|
||||||
; message. This lets syslogd specify that messages from different facilities
|
|
||||||
; will be handled differently.
|
|
||||||
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
|
|
||||||
; Default Value: daemon
|
|
||||||
;syslog.facility = daemon
|
|
||||||
|
|
||||||
; syslog_ident is prepended to every message. If you have multiple FPM
|
|
||||||
; instances running on the same server, you can change the default value
|
|
||||||
; which must suit common needs.
|
|
||||||
; Default Value: php-fpm
|
|
||||||
;syslog.ident = php-fpm
|
|
||||||
|
|
||||||
; Log level
|
|
||||||
; Possible Values: alert, error, warning, notice, debug
|
|
||||||
; Default Value: notice
|
|
||||||
;log_level = notice
|
|
||||||
|
|
||||||
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
|
|
||||||
; interval set by emergency_restart_interval then FPM will restart. A value
|
|
||||||
; of '0' means 'Off'.
|
|
||||||
; Default Value: 0
|
|
||||||
;emergency_restart_threshold = 0
|
|
||||||
|
|
||||||
; Interval of time used by emergency_restart_interval to determine when
|
|
||||||
; a graceful restart will be initiated. This can be useful to work around
|
|
||||||
; accidental corruptions in an accelerator's shared memory.
|
|
||||||
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
|
|
||||||
; Default Unit: seconds
|
|
||||||
; Default Value: 0
|
|
||||||
;emergency_restart_interval = 0
|
|
||||||
|
|
||||||
; Time limit for child processes to wait for a reaction on signals from master.
|
|
||||||
; Available units: s(econds), m(inutes), h(ours), or d(ays)
|
|
||||||
; Default Unit: seconds
|
|
||||||
; Default Value: 0
|
|
||||||
;process_control_timeout = 0
|
|
||||||
|
|
||||||
; The maximum number of processes FPM will fork. This has been design to control
|
|
||||||
; the global number of processes when using dynamic PM within a lot of pools.
|
|
||||||
; Use it with caution.
|
|
||||||
; Note: A value of 0 indicates no limit
|
|
||||||
; Default Value: 0
|
|
||||||
; process.max = 128
|
|
||||||
|
|
||||||
; Specify the nice(2) priority to apply to the master process (only if set)
|
|
||||||
; The value can vary from -19 (highest priority) to 20 (lower priority)
|
|
||||||
; Note: - It will only work if the FPM master process is launched as root
|
|
||||||
; - The pool process will inherit the master process priority
|
|
||||||
; unless it specified otherwise
|
|
||||||
; Default Value: no set
|
|
||||||
; process.priority = -19
|
|
||||||
|
|
||||||
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
|
|
||||||
; Default Value: yes
|
|
||||||
;daemonize = yes
|
|
||||||
|
|
||||||
; Set open file descriptor rlimit for the master process.
|
|
||||||
; Default Value: system defined value
|
|
||||||
;rlimit_files = 1024
|
|
||||||
|
|
||||||
; Set max core size rlimit for the master process.
|
|
||||||
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
|
||||||
; Default Value: system defined value
|
|
||||||
;rlimit_core = 0
|
|
||||||
|
|
||||||
; Specify the event mechanism FPM will use. The following is available:
|
|
||||||
; - select (any POSIX os)
|
|
||||||
; - poll (any POSIX os)
|
|
||||||
; - epoll (linux >= 2.5.44)
|
|
||||||
; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
|
|
||||||
; - /dev/poll (Solaris >= 7)
|
|
||||||
; - port (Solaris >= 10)
|
|
||||||
; Default Value: not set (auto detection)
|
|
||||||
;events.mechanism = epoll
|
|
||||||
|
|
||||||
; When FPM is build with systemd integration, specify the interval,
|
|
||||||
; in second, between health report notification to systemd.
|
|
||||||
; Set to 0 to disable.
|
|
||||||
; Available Units: s(econds), m(inutes), h(ours)
|
|
||||||
; Default Unit: seconds
|
|
||||||
; Default value: 10
|
|
||||||
;systemd_interval = 10
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; Pool Definitions ;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
; Multiple pools of child processes may be started with different listening
|
|
||||||
; ports and different management options. The name of the pool will be
|
|
||||||
; used in logs and stats. There is no limitation on the number of pools which
|
|
||||||
; FPM can handle. Your system will tell you anyway :)
|
|
||||||
|
|
||||||
; Start a new pool named 'www'.
|
|
||||||
; the variable $pool can we used in any directive and will be replaced by the
|
|
||||||
; pool name ('www' here)
|
|
||||||
[www]
|
|
||||||
|
|
||||||
; Per pool prefix
|
|
||||||
; It only applies on the following directives:
|
|
||||||
; - 'access.log'
|
|
||||||
; - 'slowlog'
|
|
||||||
; - 'listen' (unixsocket)
|
|
||||||
; - 'chroot'
|
|
||||||
; - 'chdir'
|
|
||||||
; - 'php_values'
|
|
||||||
; - 'php_admin_values'
|
|
||||||
; When not set, the global prefix (or /usr) applies instead.
|
|
||||||
; Note: This directive can also be relative to the global prefix.
|
|
||||||
; Default Value: none
|
|
||||||
;prefix = /path/to/pools/$pool
|
|
||||||
|
|
||||||
; Unix user/group of processes
|
|
||||||
; Note: The user is mandatory. If the group is not set, the default user's group
|
|
||||||
; will be used.
|
|
||||||
user = nobody
|
|
||||||
group = nobody
|
|
||||||
|
|
||||||
; The address on which to accept FastCGI requests.
|
|
||||||
; Valid syntaxes are:
|
|
||||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
|
||||||
; a specific port;
|
|
||||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
|
||||||
; a specific port;
|
|
||||||
; 'port' - to listen on a TCP socket to all IPv4 addresses on a
|
|
||||||
; specific port;
|
|
||||||
; '[::]:port' - to listen on a TCP socket to all addresses
|
|
||||||
; (IPv6 and IPv4-mapped) on a specific port;
|
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
|
||||||
; Note: This value is mandatory.
|
|
||||||
listen = 127.0.0.1:9000
|
|
||||||
|
|
||||||
; Set listen(2) backlog.
|
|
||||||
; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
|
|
||||||
;listen.backlog = 65535
|
|
||||||
|
|
||||||
; Set permissions for unix socket, if one is used. In Linux, read/write
|
|
||||||
; permissions must be set in order to allow connections from a web server. Many
|
|
||||||
; BSD-derived systems allow connections regardless of permissions.
|
|
||||||
; Default Values: user and group are set as the running user
|
|
||||||
; mode is set to 0660
|
|
||||||
;listen.owner = nobody
|
|
||||||
;listen.group = nobody
|
|
||||||
;listen.mode = 0660
|
|
||||||
; When POSIX Access Control Lists are supported you can set them using
|
|
||||||
; these options, value is a comma separated list of user/group names.
|
|
||||||
; When set, listen.owner and listen.group are ignored
|
|
||||||
;listen.acl_users =
|
|
||||||
;listen.acl_groups =
|
|
||||||
|
|
||||||
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
|
|
||||||
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
|
||||||
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
|
|
||||||
; must be separated by a comma. If this value is left blank, connections will be
|
|
||||||
; accepted from any ip address.
|
|
||||||
; Default Value: any
|
|
||||||
;listen.allowed_clients = 127.0.0.1
|
|
||||||
|
|
||||||
; Specify the nice(2) priority to apply to the pool processes (only if set)
|
|
||||||
; The value can vary from -19 (highest priority) to 20 (lower priority)
|
|
||||||
; Note: - It will only work if the FPM master process is launched as root
|
|
||||||
; - The pool processes will inherit the master process priority
|
|
||||||
; unless it specified otherwise
|
|
||||||
; Default Value: no set
|
|
||||||
; process.priority = -19
|
|
||||||
|
|
||||||
; Choose how the process manager will control the number of child processes.
|
|
||||||
; Possible Values:
|
|
||||||
; static - a fixed number (pm.max_children) of child processes;
|
|
||||||
; dynamic - the number of child processes are set dynamically based on the
|
|
||||||
; following directives. With this process management, there will be
|
|
||||||
; always at least 1 children.
|
|
||||||
; pm.max_children - the maximum number of children that can
|
|
||||||
; be alive at the same time.
|
|
||||||
; pm.start_servers - the number of children created on startup.
|
|
||||||
; pm.min_spare_servers - the minimum number of children in 'idle'
|
|
||||||
; state (waiting to process). If the number
|
|
||||||
; of 'idle' processes is less than this
|
|
||||||
; number then some children will be created.
|
|
||||||
; pm.max_spare_servers - the maximum number of children in 'idle'
|
|
||||||
; state (waiting to process). If the number
|
|
||||||
; of 'idle' processes is greater than this
|
|
||||||
; number then some children will be killed.
|
|
||||||
; ondemand - no children are created at startup. Children will be forked when
|
|
||||||
; new requests will connect. The following parameter are used:
|
|
||||||
; pm.max_children - the maximum number of children that
|
|
||||||
; can be alive at the same time.
|
|
||||||
; pm.process_idle_timeout - The number of seconds after which
|
|
||||||
; an idle process will be killed.
|
|
||||||
; Note: This value is mandatory.
|
|
||||||
pm = dynamic
|
|
||||||
|
|
||||||
; The number of child processes to be created when pm is set to 'static' and the
|
|
||||||
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
|
||||||
; This value sets the limit on the number of simultaneous requests that will be
|
|
||||||
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
|
|
||||||
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
|
|
||||||
; CGI. The below defaults are based on a server without much resources. Don't
|
|
||||||
; forget to tweak pm.* to fit your needs.
|
|
||||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
|
||||||
; Note: This value is mandatory.
|
|
||||||
pm.max_children = 5
|
|
||||||
|
|
||||||
; The number of child processes created on startup.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
|
|
||||||
pm.start_servers = 2
|
|
||||||
|
|
||||||
; The desired minimum number of idle server processes.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Note: Mandatory when pm is set to 'dynamic'
|
|
||||||
pm.min_spare_servers = 1
|
|
||||||
|
|
||||||
; The desired maximum number of idle server processes.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Note: Mandatory when pm is set to 'dynamic'
|
|
||||||
pm.max_spare_servers = 3
|
|
||||||
|
|
||||||
; The number of seconds after which an idle process will be killed.
|
|
||||||
; Note: Used only when pm is set to 'ondemand'
|
|
||||||
; Default Value: 10s
|
|
||||||
;pm.process_idle_timeout = 10s;
|
|
||||||
|
|
||||||
; The number of requests each child process should execute before respawning.
|
|
||||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
|
||||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
|
||||||
; Default Value: 0
|
|
||||||
;pm.max_requests = 500
|
|
||||||
|
|
||||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
|
||||||
; recognized as a status page. It shows the following informations:
|
|
||||||
; pool - the name of the pool;
|
|
||||||
; process manager - static, dynamic or ondemand;
|
|
||||||
; start time - the date and time FPM has started;
|
|
||||||
; start since - number of seconds since FPM has started;
|
|
||||||
; accepted conn - the number of request accepted by the pool;
|
|
||||||
; listen queue - the number of request in the queue of pending
|
|
||||||
; connections (see backlog in listen(2));
|
|
||||||
; max listen queue - the maximum number of requests in the queue
|
|
||||||
; of pending connections since FPM has started;
|
|
||||||
; listen queue len - the size of the socket queue of pending connections;
|
|
||||||
; idle processes - the number of idle processes;
|
|
||||||
; active processes - the number of active processes;
|
|
||||||
; total processes - the number of idle + active processes;
|
|
||||||
; max active processes - the maximum number of active processes since FPM
|
|
||||||
; has started;
|
|
||||||
; max children reached - number of times, the process limit has been reached,
|
|
||||||
; when pm tries to start more children (works only for
|
|
||||||
; pm 'dynamic' and 'ondemand');
|
|
||||||
; Value are updated in real time.
|
|
||||||
; Example output:
|
|
||||||
; pool: www
|
|
||||||
; process manager: static
|
|
||||||
; start time: 01/Jul/2011:17:53:49 +0200
|
|
||||||
; start since: 62636
|
|
||||||
; accepted conn: 190460
|
|
||||||
; listen queue: 0
|
|
||||||
; max listen queue: 1
|
|
||||||
; listen queue len: 42
|
|
||||||
; idle processes: 4
|
|
||||||
; active processes: 11
|
|
||||||
; total processes: 15
|
|
||||||
; max active processes: 12
|
|
||||||
; max children reached: 0
|
|
||||||
;
|
|
||||||
; By default the status page output is formatted as text/plain. Passing either
|
|
||||||
; 'html', 'xml' or 'json' in the query string will return the corresponding
|
|
||||||
; output syntax. Example:
|
|
||||||
; http://www.foo.bar/status
|
|
||||||
; http://www.foo.bar/status?json
|
|
||||||
; http://www.foo.bar/status?html
|
|
||||||
; http://www.foo.bar/status?xml
|
|
||||||
;
|
|
||||||
; By default the status page only outputs short status. Passing 'full' in the
|
|
||||||
; query string will also return status for each pool process.
|
|
||||||
; Example:
|
|
||||||
; http://www.foo.bar/status?full
|
|
||||||
; http://www.foo.bar/status?json&full
|
|
||||||
; http://www.foo.bar/status?html&full
|
|
||||||
; http://www.foo.bar/status?xml&full
|
|
||||||
; The Full status returns for each process:
|
|
||||||
; pid - the PID of the process;
|
|
||||||
; state - the state of the process (Idle, Running, ...);
|
|
||||||
; start time - the date and time the process has started;
|
|
||||||
; start since - the number of seconds since the process has started;
|
|
||||||
; requests - the number of requests the process has served;
|
|
||||||
; request duration - the duration in µs of the requests;
|
|
||||||
; request method - the request method (GET, POST, ...);
|
|
||||||
; request URI - the request URI with the query string;
|
|
||||||
; content length - the content length of the request (only with POST);
|
|
||||||
; user - the user (PHP_AUTH_USER) (or '-' if not set);
|
|
||||||
; script - the main script called (or '-' if not set);
|
|
||||||
; last request cpu - the %cpu the last request consumed
|
|
||||||
; it's always 0 if the process is not in Idle state
|
|
||||||
; because CPU calculation is done when the request
|
|
||||||
; processing has terminated;
|
|
||||||
; last request memory - the max amount of memory the last request consumed
|
|
||||||
; it's always 0 if the process is not in Idle state
|
|
||||||
; because memory calculation is done when the request
|
|
||||||
; processing has terminated;
|
|
||||||
; If the process is in Idle state, then informations are related to the
|
|
||||||
; last request the process has served. Otherwise informations are related to
|
|
||||||
; the current request being served.
|
|
||||||
; Example output:
|
|
||||||
; ************************
|
|
||||||
; pid: 31330
|
|
||||||
; state: Running
|
|
||||||
; start time: 01/Jul/2011:17:53:49 +0200
|
|
||||||
; start since: 63087
|
|
||||||
; requests: 12808
|
|
||||||
; request duration: 1250261
|
|
||||||
; request method: GET
|
|
||||||
; request URI: /test_mem.php?N=10000
|
|
||||||
; content length: 0
|
|
||||||
; user: -
|
|
||||||
; script: /home/fat/web/docs/php/test_mem.php
|
|
||||||
; last request cpu: 0.00
|
|
||||||
; last request memory: 0
|
|
||||||
;
|
|
||||||
; Note: There is a real-time FPM status monitoring sample web page available
|
|
||||||
; It's available in: /usr/share/php/fpm/status.html
|
|
||||||
;
|
|
||||||
; Note: The value must start with a leading slash (/). The value can be
|
|
||||||
; anything, but it may not be a good idea to use the .php extension or it
|
|
||||||
; may conflict with a real PHP file.
|
|
||||||
; Default Value: not set
|
|
||||||
;pm.status_path = /status
|
|
||||||
|
|
||||||
; The ping URI to call the monitoring page of FPM. If this value is not set, no
|
|
||||||
; URI will be recognized as a ping page. This could be used to test from outside
|
|
||||||
; that FPM is alive and responding, or to
|
|
||||||
; - create a graph of FPM availability (rrd or such);
|
|
||||||
; - remove a server from a group if it is not responding (load balancing);
|
|
||||||
; - trigger alerts for the operating team (24/7).
|
|
||||||
; Note: The value must start with a leading slash (/). The value can be
|
|
||||||
; anything, but it may not be a good idea to use the .php extension or it
|
|
||||||
; may conflict with a real PHP file.
|
|
||||||
; Default Value: not set
|
|
||||||
;ping.path = /ping
|
|
||||||
|
|
||||||
; This directive may be used to customize the response of a ping request. The
|
|
||||||
; response is formatted as text/plain with a 200 response code.
|
|
||||||
; Default Value: pong
|
|
||||||
;ping.response = pong
|
|
||||||
|
|
||||||
; The access log file
|
|
||||||
; Default: not set
|
|
||||||
;access.log = log/$pool.access.log
|
|
||||||
|
|
||||||
; The access log format.
|
|
||||||
; The following syntax is allowed
|
|
||||||
; %%: the '%' character
|
|
||||||
; %C: %CPU used by the request
|
|
||||||
; it can accept the following format:
|
|
||||||
; - %{user}C for user CPU only
|
|
||||||
; - %{system}C for system CPU only
|
|
||||||
; - %{total}C for user + system CPU (default)
|
|
||||||
; %d: time taken to serve the request
|
|
||||||
; it can accept the following format:
|
|
||||||
; - %{seconds}d (default)
|
|
||||||
; - %{miliseconds}d
|
|
||||||
; - %{mili}d
|
|
||||||
; - %{microseconds}d
|
|
||||||
; - %{micro}d
|
|
||||||
; %e: an environment variable (same as $_ENV or $_SERVER)
|
|
||||||
; it must be associated with embraces to specify the name of the env
|
|
||||||
; variable. Some exemples:
|
|
||||||
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
|
|
||||||
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
|
|
||||||
; %f: script filename
|
|
||||||
; %l: content-length of the request (for POST request only)
|
|
||||||
; %m: request method
|
|
||||||
; %M: peak of memory allocated by PHP
|
|
||||||
; it can accept the following format:
|
|
||||||
; - %{bytes}M (default)
|
|
||||||
; - %{kilobytes}M
|
|
||||||
; - %{kilo}M
|
|
||||||
; - %{megabytes}M
|
|
||||||
; - %{mega}M
|
|
||||||
; %n: pool name
|
|
||||||
; %o: output header
|
|
||||||
; it must be associated with embraces to specify the name of the header:
|
|
||||||
; - %{Content-Type}o
|
|
||||||
; - %{X-Powered-By}o
|
|
||||||
; - %{Transfert-Encoding}o
|
|
||||||
; - ....
|
|
||||||
; %p: PID of the child that serviced the request
|
|
||||||
; %P: PID of the parent of the child that serviced the request
|
|
||||||
; %q: the query string
|
|
||||||
; %Q: the '?' character if query string exists
|
|
||||||
; %r: the request URI (without the query string, see %q and %Q)
|
|
||||||
; %R: remote IP address
|
|
||||||
; %s: status (response code)
|
|
||||||
; %t: server time the request was received
|
|
||||||
; it can accept a strftime(3) format:
|
|
||||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
|
||||||
; %T: time the log has been written (the request has finished)
|
|
||||||
; it can accept a strftime(3) format:
|
|
||||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
|
||||||
; %u: remote user
|
|
||||||
;
|
|
||||||
; Default: "%R - %u %t \"%m %r\" %s"
|
|
||||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
|
||||||
|
|
||||||
; The log file for slow requests
|
|
||||||
; Default Value: not set
|
|
||||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
|
||||||
;slowlog = log/$pool.log.slow
|
|
||||||
|
|
||||||
; The timeout for serving a single request after which a PHP backtrace will be
|
|
||||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
|
||||||
; Default Value: 0
|
|
||||||
;request_slowlog_timeout = 0
|
|
||||||
|
|
||||||
; The timeout for serving a single request after which the worker process will
|
|
||||||
; be killed. This option should be used when the 'max_execution_time' ini option
|
|
||||||
; does not stop script execution for some reason. A value of '0' means 'off'.
|
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
|
||||||
; Default Value: 0
|
|
||||||
;request_terminate_timeout = 0
|
|
||||||
|
|
||||||
; Set open file descriptor rlimit.
|
|
||||||
; Default Value: system defined value
|
|
||||||
;rlimit_files = 1024
|
|
||||||
|
|
||||||
; Set max core size rlimit.
|
|
||||||
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
|
||||||
; Default Value: system defined value
|
|
||||||
;rlimit_core = 0
|
|
||||||
|
|
||||||
; Chroot to this directory at the start. This value must be defined as an
|
|
||||||
; absolute path. When this value is not set, chroot is not used.
|
|
||||||
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
|
||||||
; of its subdirectories. If the pool prefix is not set, the global prefix
|
|
||||||
; will be used instead.
|
|
||||||
; Note: chrooting is a great security feature and should be used whenever
|
|
||||||
; possible. However, all PHP paths will be relative to the chroot
|
|
||||||
; (error_log, sessions.save_path, ...).
|
|
||||||
; Default Value: not set
|
|
||||||
;chroot =
|
|
||||||
|
|
||||||
; Chdir to this directory at the start.
|
|
||||||
; Note: relative path can be used.
|
|
||||||
; Default Value: current directory or / when chroot
|
|
||||||
;chdir = /var/www
|
|
||||||
|
|
||||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
|
||||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
|
||||||
; Note: on highloaded environement, this can cause some delay in the page
|
|
||||||
; process time (several ms).
|
|
||||||
; Default Value: no
|
|
||||||
;catch_workers_output = yes
|
|
||||||
|
|
||||||
; Clear environment in FPM workers
|
|
||||||
; Prevents arbitrary environment variables from reaching FPM worker processes
|
|
||||||
; by clearing the environment in workers before env vars specified in this
|
|
||||||
; pool configuration are added.
|
|
||||||
; Setting to "no" will make all environment variables available to PHP code
|
|
||||||
; via getenv(), $_ENV and $_SERVER.
|
|
||||||
; Default Value: yes
|
|
||||||
;clear_env = no
|
|
||||||
|
|
||||||
; Limits the extensions of the main script FPM will allow to parse. This can
|
|
||||||
; prevent configuration mistakes on the web server side. You should only limit
|
|
||||||
; FPM to .php extensions to prevent malicious users to use other extensions to
|
|
||||||
; exectute php code.
|
|
||||||
; Note: set an empty value to allow all extensions.
|
|
||||||
; Default Value: .php
|
|
||||||
;security.limit_extensions = .php .php3 .php4 .php5
|
|
||||||
|
|
||||||
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
|
||||||
; the current environment.
|
|
||||||
; Default Value: clean env
|
|
||||||
;env[HOSTNAME] = $HOSTNAME
|
|
||||||
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
;env[TMP] = /tmp
|
|
||||||
;env[TMPDIR] = /tmp
|
|
||||||
;env[TEMP] = /tmp
|
|
||||||
|
|
||||||
; Additional php.ini defines, specific to this pool of workers. These settings
|
|
||||||
; overwrite the values previously defined in the php.ini. The directives are the
|
|
||||||
; same as the PHP SAPI:
|
|
||||||
; php_value/php_flag - you can set classic ini defines which can
|
|
||||||
; be overwritten from PHP call 'ini_set'.
|
|
||||||
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
|
||||||
; PHP call 'ini_set'
|
|
||||||
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
|
||||||
|
|
||||||
; Defining 'extension' will load the corresponding shared extension from
|
|
||||||
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
|
|
||||||
; overwrite previously defined php.ini values, but will append the new value
|
|
||||||
; instead.
|
|
||||||
|
|
||||||
; Note: path INI options can be relative and will be expanded with the prefix
|
|
||||||
; (pool, global or /usr)
|
|
||||||
|
|
||||||
; Default Value: nothing is defined by default except the values in php.ini and
|
|
||||||
; specified at startup with the -d argument
|
|
||||||
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
|
|
||||||
;php_flag[display_errors] = off
|
|
||||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
|
||||||
;php_admin_flag[log_errors] = on
|
|
||||||
;php_admin_value[memory_limit] = 32M
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
exec /bin/true
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
exec /bin/true
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
exec nginx -c /etc/nginx/nginx.conf
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
exec /bin/true
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
exec php-fpm -F
|
|
||||||
@@ -18,6 +18,6 @@ services:
|
|||||||
- "127.0.0.1:80:80"
|
- "127.0.0.1:80:80"
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
command: mariadbd --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --character-set-client-handshake=FALSE
|
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --character-set-client-handshake=FALSE
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=wallaroot
|
- MYSQL_ROOT_PASSWORD=wallaroot
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ services:
|
|||||||
- SYMFONY__ENV__DATABASE_PORT=~
|
- SYMFONY__ENV__DATABASE_PORT=~
|
||||||
- SYMFONY__ENV__DATABASE_NAME=symfony
|
- SYMFONY__ENV__DATABASE_NAME=symfony
|
||||||
- SYMFONY__ENV__DATABASE_USER=root
|
- SYMFONY__ENV__DATABASE_USER=root
|
||||||
- SYMFONY__ENV__DATABASE_PASSWORD=~
|
- SYMFONY__ENV_DATABASE_PASSWORD=~
|
||||||
- SYMFONY__ENV__SECRET=F00B4R
|
- SYMFONY__ENV__SECRET=F00B4R
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:80:80"
|
- "127.0.0.1:80:80"
|
||||||
|
|||||||
@@ -1,53 +1,13 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import os
|
|
||||||
|
|
||||||
from requests.exceptions import ConnectionError
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
URL = 'http://127.0.0.1:80'
|
||||||
def database(pytestconfig):
|
|
||||||
return pytestconfig.getoption("database")
|
|
||||||
|
|
||||||
def is_responsive(url):
|
|
||||||
try:
|
|
||||||
response = requests.get(url)
|
|
||||||
if response.status_code == 200:
|
|
||||||
return True
|
|
||||||
except ConnectionError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
def test_accessing_login_page():
|
||||||
def docker_compose_project_name(database):
|
r = requests.get(URL, allow_redirects=True)
|
||||||
return "wallabag_{}".format(database)
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
|
||||||
def docker_cleanup():
|
|
||||||
"""Disable docker cleanup at the end of tests to get logs outside of pytest"""
|
|
||||||
return False
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
|
||||||
def docker_compose_command() -> str:
|
|
||||||
return "docker-compose"
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
|
||||||
def docker_compose_file(pytestconfig, database):
|
|
||||||
return os.path.join(str(pytestconfig.rootdir), "tests/", "docker-compose.{}.yml".format(database))
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
|
||||||
def wallabag_service(docker_ip, docker_services):
|
|
||||||
"""Ensure that wallabag service is up and responsive"""
|
|
||||||
|
|
||||||
# `port_for` takes a container port and returns the corresponding host port
|
|
||||||
port = docker_services.port_for("wallabag", 80)
|
|
||||||
url = "http://{}:{}".format(docker_ip, port)
|
|
||||||
docker_services.wait_until_responsive(
|
|
||||||
timeout=60.0, pause=0.5, check=lambda: is_responsive(url)
|
|
||||||
)
|
|
||||||
return url
|
|
||||||
|
|
||||||
def test_accessing_login_page(wallabag_service):
|
|
||||||
r = requests.get(wallabag_service, allow_redirects=True)
|
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert 'Log in' in r.text
|
assert 'Log in' in r.text
|
||||||
@@ -56,9 +16,9 @@ def test_accessing_login_page(wallabag_service):
|
|||||||
assert 'Username' in r.text
|
assert 'Username' in r.text
|
||||||
|
|
||||||
|
|
||||||
def test_logging_in(wallabag_service):
|
def test_logging_in():
|
||||||
client = requests.session()
|
client = requests.session()
|
||||||
r = client.get(wallabag_service, allow_redirects=True)
|
r = client.get(URL, allow_redirects=True)
|
||||||
jar = r.cookies
|
jar = r.cookies
|
||||||
|
|
||||||
# get csrf token
|
# get csrf token
|
||||||
@@ -79,7 +39,7 @@ def test_logging_in(wallabag_service):
|
|||||||
'_csrf_token': csrf
|
'_csrf_token': csrf
|
||||||
}
|
}
|
||||||
|
|
||||||
r = client.post(wallabag_service + '/login_check', cookies=jar, data=data)
|
r = client.post(URL + '/login_check', cookies=jar, data=data)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert '/unread/list' in r.text
|
assert '/unread/list' in r.text
|
||||||
assert '/starred/list' in r.text
|
assert '/starred/list' in r.text
|
||||||
|
|||||||
Reference in New Issue
Block a user