mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-11 17:51:02 +00:00
Merge pull request #1561 from FabienM/docker-compose
Add basic docker-compose configuration
This commit is contained in:
commit
0aafb8dfcb
9 changed files with 231 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -36,3 +36,7 @@
|
||||||
# Data for wallabag
|
# Data for wallabag
|
||||||
data/assets/*
|
data/assets/*
|
||||||
data/db/wallabag*.sqlite
|
data/db/wallabag*.sqlite
|
||||||
|
|
||||||
|
# Docker container logs and data
|
||||||
|
docker/logs/
|
||||||
|
docker/data/
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
# This file is a "template" of what your parameters.yml file should look like
|
# This file is a "template" of what your parameters.yml file should look like
|
||||||
parameters:
|
parameters:
|
||||||
|
# Uncomment these settings or manually update your parameters.yml
|
||||||
|
# to use docker-compose
|
||||||
|
#
|
||||||
|
# database_driver: %env.database_driver%
|
||||||
|
# database_host: %env.database_host%
|
||||||
|
# database_port: %env.database_port%
|
||||||
|
# database_name: %env.database_name%
|
||||||
|
# database_user: %env.database_user%
|
||||||
|
# database_password: %env.database_password%
|
||||||
|
|
||||||
database_driver: pdo_sqlite
|
database_driver: pdo_sqlite
|
||||||
database_host: 127.0.0.1
|
database_host: 127.0.0.1
|
||||||
database_port: ~
|
database_port: ~
|
||||||
|
|
42
docker-compose.yml
Normal file
42
docker-compose.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- ./docker/nginx/nginx.conf:/nginx.conf
|
||||||
|
- ./docker/logs/nginx:/var/log/nginx
|
||||||
|
- .:/var/www/html
|
||||||
|
links:
|
||||||
|
- php:php
|
||||||
|
command: nginx -c /nginx.conf
|
||||||
|
php:
|
||||||
|
build: docker/php
|
||||||
|
ports:
|
||||||
|
- "9000:9000"
|
||||||
|
volumes:
|
||||||
|
- .:/var/www/html
|
||||||
|
#links:
|
||||||
|
# - "postgres:rdbms"
|
||||||
|
# - "mariadb:rdbms"
|
||||||
|
env_file:
|
||||||
|
- ./docker/php/env
|
||||||
|
# Comment non-used DBMS lines
|
||||||
|
# If all DBMS are commented out, sqlite will be used as default
|
||||||
|
# - ./docker/postgres/env
|
||||||
|
# - ./docker/mariadb/env
|
||||||
|
#postgres:
|
||||||
|
# image: postgres:9
|
||||||
|
# ports:
|
||||||
|
# - "5432:5432"
|
||||||
|
# volumes:
|
||||||
|
# - ./docker/data/pgsql:/var/lib/postgresql/data
|
||||||
|
# env_file:
|
||||||
|
# - ./docker/postgres/env
|
||||||
|
#mariadb:
|
||||||
|
# image: mariadb:10
|
||||||
|
# ports:
|
||||||
|
# - "3306:3306"
|
||||||
|
# volumes:
|
||||||
|
# - ./docker/data/mariadb:/var/lib/mysql
|
||||||
|
# env_file:
|
||||||
|
# - ./docker/mariadb/env
|
10
docker/mariadb/env
Normal file
10
docker/mariadb/env
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
MYSQL_ROOT_PASSWORD=wallaroot
|
||||||
|
MYSQL_USER=wallabag
|
||||||
|
MYSQL_PASSWORD=wallapass
|
||||||
|
MYSQL_DATABASE=wallabag
|
||||||
|
SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
|
||||||
|
SYMFONY__ENV__DATABASE_HOST=rdbms
|
||||||
|
SYMFONY__ENV__DATABASE_PORT=3306
|
||||||
|
SYMFONY__ENV__DATABASE_NAME=wallabag
|
||||||
|
SYMFONY__ENV__DATABASE_USER=wallabag
|
||||||
|
SYMFONY__ENV__DATABASE_PASSWORD=wallapass
|
89
docker/nginx/nginx.conf
Normal file
89
docker/nginx/nginx.conf
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 2048;
|
||||||
|
multi_accept on;
|
||||||
|
use epoll;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
upstream php-upstream {
|
||||||
|
server php:9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
#server_name domain.tld www.domain.tld;
|
||||||
|
root /var/www/html/web;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# try to serve file directly, fallback to app.php
|
||||||
|
try_files $uri /app.php$is_args$args;
|
||||||
|
}
|
||||||
|
# DEV
|
||||||
|
# This rule should only be placed on your development environment
|
||||||
|
# In production, don't include this and don't deploy app_dev.php or config.php
|
||||||
|
location ~ ^/(app_dev|config)\.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;
|
||||||
|
}
|
||||||
|
# PROD
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_log /var/log/nginx/project_error.log;
|
||||||
|
access_log /var/log/nginx/project_access.log;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
daemon off;
|
10
docker/php/Dockerfile
Normal file
10
docker/php/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
FROM php:fpm
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libmcrypt-dev libicu-dev libpq-dev libxml2-dev \
|
||||||
|
&& docker-php-ext-install \
|
||||||
|
iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql
|
||||||
|
|
||||||
|
RUN usermod -u 1000 www-data
|
||||||
|
|
||||||
|
CMD ["php-fpm"]
|
6
docker/php/env
Normal file
6
docker/php/env
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
SYMFONY__ENV__DATABASE_DRIVER=pdo_sqlite
|
||||||
|
SYMFONY__ENV__DATABASE_HOST=127.0.0.1
|
||||||
|
SYMFONY__ENV__DATABASE_PORT=~
|
||||||
|
SYMFONY__ENV__DATABASE_NAME=symfony
|
||||||
|
SYMFONY__ENV__DATABASE_USER=root
|
||||||
|
SYMFONY__ENV__DATABASE_PASSWORD=~
|
9
docker/postgres/env
Normal file
9
docker/postgres/env
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
POSTGRES_USER=wallabag
|
||||||
|
POSTGRES_PASSWORD=wallapass
|
||||||
|
POSTGRES_DB=wallabag
|
||||||
|
export SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
|
||||||
|
export SYMFONY__ENV__DATABASE_HOST=rdbms
|
||||||
|
export SYMFONY__ENV__DATABASE_PORT=5432
|
||||||
|
export SYMFONY__ENV__DATABASE_NAME=wallabag
|
||||||
|
export SYMFONY__ENV__DATABASE_USER=wallabag
|
||||||
|
export SYMFONY__ENV__DATABASE_PASSWORD=wallapass
|
51
docs/en/developer/docker.rst
Normal file
51
docs/en/developer/docker.rst
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
Run Wallabag in docker-compose
|
||||||
|
==============================
|
||||||
|
|
||||||
|
In order to run your own development instance of wallabag, you may
|
||||||
|
want to use the pre-configured docker compose files.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Make sure to have `Docker
|
||||||
|
<https://docs.docker.com/installation/ubuntulinux/>`__ and `Docker
|
||||||
|
Compose <https://docs.docker.com/compose/install/>`__ availables on
|
||||||
|
your system and up to date.
|
||||||
|
|
||||||
|
Switch DBMS
|
||||||
|
-----------
|
||||||
|
|
||||||
|
By default, Wallabag will start with a sqlite database.
|
||||||
|
Since Wallabag provide support for Postgresql and MySQL, docker
|
||||||
|
containers are also available for these ones.
|
||||||
|
|
||||||
|
In ``docker-compose.yml``, for the chosen DBMS uncomment :
|
||||||
|
|
||||||
|
- the container definition (``postgres`` or ``mariadb`` root level
|
||||||
|
block)
|
||||||
|
- the container link in the ``php`` container
|
||||||
|
- the container env file in the ``php`` container
|
||||||
|
|
||||||
|
In order to keep running Symfony commands on your host (such as
|
||||||
|
``wallabag:install``), you also should :
|
||||||
|
|
||||||
|
- source the proper env files on your command line, so variables
|
||||||
|
like ``SYMFONY__ENV__DATABASE_HOST`` will exist.
|
||||||
|
- create a ``127.0.0.1 rdbms`` on your system ``hosts`` file
|
||||||
|
|
||||||
|
Run Wallabag
|
||||||
|
------------
|
||||||
|
|
||||||
|
#. Fork and clone the project
|
||||||
|
#. Edit ``app/config/parameters.yml`` to replace ``database_*``
|
||||||
|
properties with commented ones (with values prefixed by ``env.``)
|
||||||
|
#. ``composer install`` the project dependencies
|
||||||
|
#. ``php app/console wallabag:install`` to create the schema
|
||||||
|
#. ``docker-compose up`` to run the containers
|
||||||
|
#. Finally, browse to http://localhost:8080/ to find your freshly
|
||||||
|
installed wallabag.
|
||||||
|
|
||||||
|
At various step, you'll probably run into UNIX permission problems,
|
||||||
|
bad paths in generated cache, etc…
|
||||||
|
Operations like removing cache files or changing files owners might
|
||||||
|
be frequently required, so don't be afraid !
|
Loading…
Add table
Add a link
Reference in a new issue