diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | app/config/parameters.yml.dist | 10 | ||||
-rw-r--r-- | docker-compose.yml | 42 | ||||
-rw-r--r-- | docker/mariadb/env | 10 | ||||
-rw-r--r-- | docker/nginx/nginx.conf | 89 | ||||
-rw-r--r-- | docker/php/Dockerfile | 10 | ||||
-rw-r--r-- | docker/php/env | 6 | ||||
-rw-r--r-- | docker/postgres/env | 9 | ||||
-rw-r--r-- | docs/en/developer/docker.rst | 51 |
9 files changed, 231 insertions, 0 deletions
@@ -36,3 +36,7 @@ | |||
36 | # Data for wallabag | 36 | # Data for wallabag |
37 | data/assets/* | 37 | data/assets/* |
38 | data/db/wallabag*.sqlite | 38 | data/db/wallabag*.sqlite |
39 | |||
40 | # Docker container logs and data | ||
41 | docker/logs/ | ||
42 | docker/data/ | ||
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index a769bc66..0c0cbff1 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -1,5 +1,15 @@ | |||
1 | # This file is a "template" of what your parameters.yml file should look like | 1 | # This file is a "template" of what your parameters.yml file should look like |
2 | parameters: | 2 | parameters: |
3 | # Uncomment these settings or manually update your parameters.yml | ||
4 | # to use docker-compose | ||
5 | # | ||
6 | # database_driver: %env.database_driver% | ||
7 | # database_host: %env.database_host% | ||
8 | # database_port: %env.database_port% | ||
9 | # database_name: %env.database_name% | ||
10 | # database_user: %env.database_user% | ||
11 | # database_password: %env.database_password% | ||
12 | |||
3 | database_driver: pdo_sqlite | 13 | database_driver: pdo_sqlite |
4 | database_host: 127.0.0.1 | 14 | database_host: 127.0.0.1 |
5 | database_port: ~ | 15 | database_port: ~ |
diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..c774b621 --- /dev/null +++ b/docker-compose.yml | |||
@@ -0,0 +1,42 @@ | |||
1 | nginx: | ||
2 | image: nginx | ||
3 | ports: | ||
4 | - "8080:80" | ||
5 | volumes: | ||
6 | - ./docker/nginx/nginx.conf:/nginx.conf | ||
7 | - ./docker/logs/nginx:/var/log/nginx | ||
8 | - .:/var/www/html | ||
9 | links: | ||
10 | - php:php | ||
11 | command: nginx -c /nginx.conf | ||
12 | php: | ||
13 | build: docker/php | ||
14 | ports: | ||
15 | - "9000:9000" | ||
16 | volumes: | ||
17 | - .:/var/www/html | ||
18 | #links: | ||
19 | # - "postgres:rdbms" | ||
20 | # - "mariadb:rdbms" | ||
21 | env_file: | ||
22 | - ./docker/php/env | ||
23 | # Comment non-used DBMS lines | ||
24 | # If all DBMS are commented out, sqlite will be used as default | ||
25 | # - ./docker/postgres/env | ||
26 | # - ./docker/mariadb/env | ||
27 | #postgres: | ||
28 | # image: postgres:9 | ||
29 | # ports: | ||
30 | # - "5432:5432" | ||
31 | # volumes: | ||
32 | # - ./docker/data/pgsql:/var/lib/postgresql/data | ||
33 | # env_file: | ||
34 | # - ./docker/postgres/env | ||
35 | #mariadb: | ||
36 | # image: mariadb:10 | ||
37 | # ports: | ||
38 | # - "3306:3306" | ||
39 | # volumes: | ||
40 | # - ./docker/data/mariadb:/var/lib/mysql | ||
41 | # env_file: | ||
42 | # - ./docker/mariadb/env | ||
diff --git a/docker/mariadb/env b/docker/mariadb/env new file mode 100644 index 00000000..87556a15 --- /dev/null +++ b/docker/mariadb/env | |||
@@ -0,0 +1,10 @@ | |||
1 | MYSQL_ROOT_PASSWORD=wallaroot | ||
2 | MYSQL_USER=wallabag | ||
3 | MYSQL_PASSWORD=wallapass | ||
4 | MYSQL_DATABASE=wallabag | ||
5 | SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql | ||
6 | SYMFONY__ENV__DATABASE_HOST=rdbms | ||
7 | SYMFONY__ENV__DATABASE_PORT=3306 | ||
8 | SYMFONY__ENV__DATABASE_NAME=wallabag | ||
9 | SYMFONY__ENV__DATABASE_USER=wallabag | ||
10 | SYMFONY__ENV__DATABASE_PASSWORD=wallapass | ||
diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 00000000..7e82a0f8 --- /dev/null +++ b/docker/nginx/nginx.conf | |||
@@ -0,0 +1,89 @@ | |||
1 | user nginx; | ||
2 | worker_processes 1; | ||
3 | pid /var/run/nginx.pid; | ||
4 | |||
5 | events { | ||
6 | worker_connections 2048; | ||
7 | multi_accept on; | ||
8 | use epoll; | ||
9 | } | ||
10 | |||
11 | http { | ||
12 | |||
13 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
14 | '$status $body_bytes_sent "$http_referer" ' | ||
15 | '"$http_user_agent" "$http_x_forwarded_for"'; | ||
16 | |||
17 | access_log /var/log/nginx/access.log main; | ||
18 | |||
19 | server_tokens off; | ||
20 | sendfile on; | ||
21 | tcp_nopush on; | ||
22 | tcp_nodelay on; | ||
23 | keepalive_timeout 15; | ||
24 | types_hash_max_size 2048; | ||
25 | include /etc/nginx/mime.types; | ||
26 | default_type application/octet-stream; | ||
27 | access_log off; | ||
28 | error_log off; | ||
29 | gzip on; | ||
30 | gzip_disable "msie6"; | ||
31 | open_file_cache max=100; | ||
32 | |||
33 | |||
34 | upstream php-upstream { | ||
35 | server php:9000; | ||
36 | } | ||
37 | |||
38 | server { | ||
39 | #server_name domain.tld www.domain.tld; | ||
40 | root /var/www/html/web; | ||
41 | |||
42 | location / { | ||
43 | # try to serve file directly, fallback to app.php | ||
44 | try_files $uri /app.php$is_args$args; | ||
45 | } | ||
46 | # DEV | ||
47 | # This rule should only be placed on your development environment | ||
48 | # In production, don't include this and don't deploy app_dev.php or config.php | ||
49 | location ~ ^/(app_dev|config)\.php(/|$) { | ||
50 | fastcgi_pass php-upstream; | ||
51 | fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
52 | include fastcgi_params; | ||
53 | # When you are using symlinks to link the document root to the | ||
54 | # current version of your application, you should pass the real | ||
55 | # application path instead of the path to the symlink to PHP | ||
56 | # FPM. | ||
57 | # Otherwise, PHP's OPcache may not properly detect changes to | ||
58 | # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | ||
59 | # for more information). | ||
60 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
61 | fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
62 | } | ||
63 | # PROD | ||
64 | location ~ ^/app\.php(/|$) { | ||
65 | fastcgi_pass php-upstream; | ||
66 | fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
67 | include fastcgi_params; | ||
68 | # When you are using symlinks to link the document root to the | ||
69 | # current version of your application, you should pass the real | ||
70 | # application path instead of the path to the symlink to PHP | ||
71 | # FPM. | ||
72 | # Otherwise, PHP's OPcache may not properly detect changes to | ||
73 | # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | ||
74 | # for more information). | ||
75 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
76 | fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
77 | # Prevents URIs that include the front controller. This will 404: | ||
78 | # http://domain.tld/app.php/some-path | ||
79 | # Remove the internal directive to allow URIs like this | ||
80 | internal; | ||
81 | } | ||
82 | |||
83 | error_log /var/log/nginx/project_error.log; | ||
84 | access_log /var/log/nginx/project_access.log; | ||
85 | } | ||
86 | |||
87 | } | ||
88 | |||
89 | daemon off; | ||
diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 00000000..7c56ae57 --- /dev/null +++ b/docker/php/Dockerfile | |||
@@ -0,0 +1,10 @@ | |||
1 | FROM php:fpm | ||
2 | |||
3 | RUN apt-get update && apt-get install -y \ | ||
4 | libmcrypt-dev libicu-dev libpq-dev libxml2-dev \ | ||
5 | && docker-php-ext-install \ | ||
6 | iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql | ||
7 | |||
8 | RUN usermod -u 1000 www-data | ||
9 | |||
10 | CMD ["php-fpm"] | ||
diff --git a/docker/php/env b/docker/php/env new file mode 100644 index 00000000..935134fc --- /dev/null +++ b/docker/php/env | |||
@@ -0,0 +1,6 @@ | |||
1 | SYMFONY__ENV__DATABASE_DRIVER=pdo_sqlite | ||
2 | SYMFONY__ENV__DATABASE_HOST=127.0.0.1 | ||
3 | SYMFONY__ENV__DATABASE_PORT=~ | ||
4 | SYMFONY__ENV__DATABASE_NAME=symfony | ||
5 | SYMFONY__ENV__DATABASE_USER=root | ||
6 | SYMFONY__ENV__DATABASE_PASSWORD=~ | ||
diff --git a/docker/postgres/env b/docker/postgres/env new file mode 100644 index 00000000..80c78c2a --- /dev/null +++ b/docker/postgres/env | |||
@@ -0,0 +1,9 @@ | |||
1 | POSTGRES_USER=wallabag | ||
2 | POSTGRES_PASSWORD=wallapass | ||
3 | POSTGRES_DB=wallabag | ||
4 | export SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql | ||
5 | export SYMFONY__ENV__DATABASE_HOST=rdbms | ||
6 | export SYMFONY__ENV__DATABASE_PORT=5432 | ||
7 | export SYMFONY__ENV__DATABASE_NAME=wallabag | ||
8 | export SYMFONY__ENV__DATABASE_USER=wallabag | ||
9 | export SYMFONY__ENV__DATABASE_PASSWORD=wallapass | ||
diff --git a/docs/en/developer/docker.rst b/docs/en/developer/docker.rst new file mode 100644 index 00000000..9ed9dde2 --- /dev/null +++ b/docs/en/developer/docker.rst | |||
@@ -0,0 +1,51 @@ | |||
1 | Run Wallabag in docker-compose | ||
2 | ============================== | ||
3 | |||
4 | In order to run your own development instance of wallabag, you may | ||
5 | want to use the pre-configured docker compose files. | ||
6 | |||
7 | Requirements | ||
8 | ------------ | ||
9 | |||
10 | Make sure to have `Docker | ||
11 | <https://docs.docker.com/installation/ubuntulinux/>`__ and `Docker | ||
12 | Compose <https://docs.docker.com/compose/install/>`__ availables on | ||
13 | your system and up to date. | ||
14 | |||
15 | Switch DBMS | ||
16 | ----------- | ||
17 | |||
18 | By default, Wallabag will start with a sqlite database. | ||
19 | Since Wallabag provide support for Postgresql and MySQL, docker | ||
20 | containers are also available for these ones. | ||
21 | |||
22 | In ``docker-compose.yml``, for the chosen DBMS uncomment : | ||
23 | |||
24 | - the container definition (``postgres`` or ``mariadb`` root level | ||
25 | block) | ||
26 | - the container link in the ``php`` container | ||
27 | - the container env file in the ``php`` container | ||
28 | |||
29 | In order to keep running Symfony commands on your host (such as | ||
30 | ``wallabag:install``), you also should : | ||
31 | |||
32 | - source the proper env files on your command line, so variables | ||
33 | like ``SYMFONY__ENV__DATABASE_HOST`` will exist. | ||
34 | - create a ``127.0.0.1 rdbms`` on your system ``hosts`` file | ||
35 | |||
36 | Run Wallabag | ||
37 | ------------ | ||
38 | |||
39 | #. Fork and clone the project | ||
40 | #. Edit ``app/config/parameters.yml`` to replace ``database_*`` | ||
41 | properties with commented ones (with values prefixed by ``env.``) | ||
42 | #. ``composer install`` the project dependencies | ||
43 | #. ``php app/console wallabag:install`` to create the schema | ||
44 | #. ``docker-compose up`` to run the containers | ||
45 | #. Finally, browse to http://localhost:8080/ to find your freshly | ||
46 | installed wallabag. | ||
47 | |||
48 | At various step, you'll probably run into UNIX permission problems, | ||
49 | bad paths in generated cache, etc… | ||
50 | Operations like removing cache files or changing files owners might | ||
51 | be frequently required, so don't be afraid ! | ||