From fb020c3be697e2b94e88064d46f63b40c12fbe4b Mon Sep 17 00:00:00 2001 From: Marvin Steadfast Date: Tue, 31 Jan 2017 16:33:19 +0100 Subject: [PATCH] Version bumb to 2.2.1 and added migrate command made the changes to get 2.2.1 running plus added a migrate command to the entrypoint. documented it in the readme. --- Dockerfile | 4 ++-- README.md | 12 +++++++++--- root/entrypoint.sh | 5 +++++ root/etc/ansible/entrypoint.yml | 4 +--- root/etc/ansible/templates/parameters.yml.j2 | 6 ++++++ root/var/www/wallabag/app/config/parameters.yml | 6 ++++++ 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c29358..361ac19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM alpine:edge MAINTAINER Marvin Steadfast -ENV WALLABAG_VERSION=2.1.6 \ - POSTGRES_USER=postgres +ARG WALLABAG_VERSION=2.2.1 +ARG POSTGRES_USER=postgres RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ && apk add --update \ diff --git a/README.md b/README.md index d9ad103..09e2abc 100644 --- a/README.md +++ b/README.md @@ -72,12 +72,18 @@ $ docker run -p 6379:6379 --name redis redis:alpine $ docker run -p 80:80 --link redis:redis wallabag/wallabag ``` -## DB migration +## Upgrading -If there is a version upgrade that needs a database migration, you should start the container with the new image and run the migration command. +If there is a version upgrade that needs a database migration. The most easy way to do is running the `migrate` command: ``` -$ docker exec -t wallabag /var/www/wallabag/bin/console doctrine:migrations:migrate --env=prod --no-interaction +$ docker run --link wallabag-db:wallabag-db -e <... your config variables here ...> wallabag/wallabag migrate +``` + +Or you can start the container with the new image and run the migration command manually: + +``` +$ docker exec -t NAME_OR_ID_OF_YOUR_WALLABAG_CONTAINER /var/www/wallabag/bin/console doctrine:migrations:migrate --env=prod --no-interaction ``` ## docker-compose diff --git a/root/entrypoint.sh b/root/entrypoint.sh index bcb59e8..3f5304a 100755 --- a/root/entrypoint.sh +++ b/root/entrypoint.sh @@ -9,5 +9,10 @@ if [ "$1" = "import" ];then cd /var/www/wallabag/ exec su -c "bin/console wallabag:import:redis-worker -e=prod $2 -vv" -s /bin/sh nobody fi +if [ "$1" = "migrate" ];then + ansible-playbook -i /etc/ansible/hosts /etc/ansible/entrypoint.yml -c local + cd /var/www/wallabag/ + exec su -c "bin/console doctrine:migrations:migrate --env=prod --no-interaction" -s /bin/sh nobody +fi exec "$@" diff --git a/root/etc/ansible/entrypoint.yml b/root/etc/ansible/entrypoint.yml index 0dda127..33096dc 100644 --- a/root/etc/ansible/entrypoint.yml +++ b/root/etc/ansible/entrypoint.yml @@ -61,8 +61,6 @@ port="{{ database_port }}" when: (database_driver == 'pdo_mysql') or (database_driver == 'pdo_pgsql') - tags: - - firstrun - name: add mariadb db mysql_db: @@ -104,7 +102,7 @@ login_user="{{ database_root_user_postgres }}" login_password="{{ database_root_password_postgres }}" notify: run install - when: (database_driver == 'pdo_pgsql') and + when: (database_driver == 'pdo_pgsql') and (populate_database == True) tags: - firstrun diff --git a/root/etc/ansible/templates/parameters.yml.j2 b/root/etc/ansible/templates/parameters.yml.j2 index c994aff..f9f7270 100644 --- a/root/etc/ansible/templates/parameters.yml.j2 +++ b/root/etc/ansible/templates/parameters.yml.j2 @@ -8,6 +8,7 @@ parameters: database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" database_table_prefix: wallabag_ database_socket: null + database_charset: utf8 mailer_transport: smtp mailer_host: {{ mailer_host }} @@ -36,9 +37,14 @@ parameters: rabbitmq_port: 5672 rabbitmq_user: guest rabbitmq_password: guest + rabbitmq_prefetch_count: 10 # Redis processing redis_scheme: tcp redis_host: redis redis_port: 6379 redis_path: null + redis_password: null + + # sites credentials + sites_credentials: {} diff --git a/root/var/www/wallabag/app/config/parameters.yml b/root/var/www/wallabag/app/config/parameters.yml index 07864d9..4ad5739 100644 --- a/root/var/www/wallabag/app/config/parameters.yml +++ b/root/var/www/wallabag/app/config/parameters.yml @@ -8,6 +8,7 @@ parameters: database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" database_table_prefix: wallabag_ database_socket: null + database_charset: utf8 test_database_driver: pdo_sqlite test_database_host: 127.0.0.1 @@ -44,9 +45,14 @@ parameters: rabbitmq_port: 5672 rabbitmq_user: guest rabbitmq_password: guest + rabbitmq_prefetch_count: 10 # Redis processing redis_scheme: tcp redis_host: localhost redis_port: 6379 redis_path: null + redis_password: null + + # sites credentials + sites_credentials: {}