From 4094d3c9ff68667983c227aaf772bc0476a1371a Mon Sep 17 00:00:00 2001 From: Mohamed MOUNIROU Date: Wed, 24 Aug 2016 18:25:03 +0200 Subject: [PATCH 1/3] give the ability to change postgres root user This can be acheived by setting the environment variable POSTGRES_USER --- README.md | 7 ++++--- root/etc/ansible/entrypoint.yml | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2f8155c..8f7bcfb 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Default login is `wallabag:wallabag`. - `-e MYSQL_ROOT_PASSWORD=...` (needed for the mariadb container to initialise and for the entrypoint in the wallabag container to create a database and user if its not there) - `-e POSTGRES_PASSWORD=...` (needed for the posgres container to initialise and for the entrypoint in the wallabag container to create a database and user if not there) +- `-e POSTGRES_USER=...` (needed for the posgres container to initialise and for the entrypoint in the wallabag container to create a database and user if not there) - `-e SYMFONY__ENV__DATABASE_DRIVER=...` (defaults to "pdo_sqlite", this sets the database driver to use) - `-e SYMFONY__ENV__DATABASE_HOST=...` (defaults to "127.0.0.1", if use mysql this should be the name of the mariadb container) - `-e SYMFONY__ENV__DATABASE_PORT=...` (port of the database host) @@ -43,7 +44,7 @@ $ docker run -v /opt/wallabag:/var/www/wallabag/data -p 80:80 wallabag/wallabag For using MariaDB or MySQL you have to define some environment variables with the container. Example: ``` -$ docker run docker run --name wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -d mariadb +$ docker run docker run --name wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -d mariadb $ docker run --name wallabag --link wallabag-db:wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=3306" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag ``` @@ -52,8 +53,8 @@ $ docker run --name wallabag --link wallabag-db:wallabag-db -e "MYSQL_ROOT_PASSW For using PostgreSQL you have to define some environment variables with the container. Example: ``` -$ docker run docker run --name wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -d postgres -$ docker run --name wallabag --link wallabag-db:wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=5432" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag +$ docker run docker run --name wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -e "POSTGRES_USER=my-super-user" -d postgres +$ docker run --name wallabag --link wallabag-db:wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -e "POSTGRES_USER=my-super-user" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=5432" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag ``` ## docker-compose diff --git a/root/etc/ansible/entrypoint.yml b/root/etc/ansible/entrypoint.yml index 08c306c..1c9ae36 100644 --- a/root/etc/ansible/entrypoint.yml +++ b/root/etc/ansible/entrypoint.yml @@ -10,6 +10,7 @@ database_password: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PASSWORD') }}" database_port: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PORT') }}" database_root_password_mariadb: "{{ lookup('env', 'MYSQL_ROOT_PASSWORD') }}" + database_root_user_postgres: "{{ lookup('env', 'POSTGRES_USER') }}" database_root_password_postgres: "{{ lookup('env', 'POSTGRES_PASSWORD') }}" database_user: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_USER') }}" @@ -75,7 +76,7 @@ state=present login_host="{{ database_host }}" port={{ database_port }} - login_user=postgres + login_user="{{ database_root_user_postgres }}" login_password="{{ database_root_password_postgres }}" notify: run install when: database_driver == 'pdo_pgsql' @@ -88,7 +89,7 @@ priv=ALL login_host="{{ database_host }}" port={{ database_port }} - login_user=postgres + login_user="{{ database_root_user_postgres }}" login_password="{{ database_root_password_postgres }}" state=present when: (database_driver == 'pdo_pgsql') and From 255fe53dfca9aa709698a1cdd0546b9550d5516a Mon Sep 17 00:00:00 2001 From: Mohamed MOUNIROU Date: Wed, 24 Aug 2016 18:28:34 +0200 Subject: [PATCH 2/3] set the default value for POSTGRES_USER to postgres This is done in order to ensure backward compatibility --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 79e4739..80ec312 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ENV WALLABAG_VERSION=2.0.7 \ SYMFONY__ENV__DATABASE_NAME=symfony \ SYMFONY__ENV__DATABASE_USER=root \ SYMFONY__ENV__DATABASE_PASSWORD=~ \ + POSTGRES_USER=postgres \ SYMFONY__ENV__SECRET=ovmpmAWXRCabNlMgzlzFXDYmCFfzGv \ SYMFONY__ENV__MAILER_HOST=127.0.0.1 \ SYMFONY__ENV__MAILER_USER=~ \ From 67030c1c365540c9798750adce19392c678b1eae Mon Sep 17 00:00:00 2001 From: Mohamed MOUNIROU Date: Thu, 25 Aug 2016 10:23:31 +0200 Subject: [PATCH 3/3] remove an unnecessary white space --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f7bcfb..e264aa6 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ $ docker run -v /opt/wallabag:/var/www/wallabag/data -p 80:80 wallabag/wallabag For using MariaDB or MySQL you have to define some environment variables with the container. Example: ``` -$ docker run docker run --name wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -d mariadb +$ docker run docker run --name wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -d mariadb $ docker run --name wallabag --link wallabag-db:wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=3306" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag ```