From 8de7de4588f82ae9b82b9b87ed5d6612143b39c8 Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Fri, 1 Nov 2019 18:59:13 +0100 Subject: [PATCH 1/5] use Dockerfile.apache by default In docker-compose, using a symlink from ./Dockerfile to contrib/docker/Dockerfile.apache does not work. Therefore the symlink is deleted and the docker-compose.yml is instructed to use the file Dockerfile.apache in contrib by default. --- Dockerfile | 1 - docker-compose.yml | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) delete mode 120000 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 120000 index 2f722aa37..000000000 --- a/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -contrib/docker/Dockerfile.apache \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 3d9cccc02..0d6c501a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,10 @@ services: app: # Comment to use dockerhub image - build: . + build: + context: . + dockerfile: contrib/docker/Dockerfile.apache + #dockerfile: contrib/docker/Dockerfile.fpm image: pixelfed restart: unless-stopped ## If you have a traefik running, uncomment this to expose Pixelfed @@ -36,7 +39,10 @@ services: worker: # Comment this whole block if HORIZON_EMBED is true. # Comment to use dockerhub image - build: . + build: + context: . + dockerfile: contrib/docker/Dockerfile.apache + #dockerfile: contrib/docker/Dockerfile.fpm image: pixelfed restart: unless-stopped env_file: From ffe507077861e43f2a4d840f6ce2ac193cf007fc Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Fri, 1 Nov 2019 19:01:40 +0100 Subject: [PATCH 2/5] docker db use native password as auth method This commit changes the default auth plugin of mysql to mysql_native_password, because otherwise the laravel app couldn't connect to the mysql database. The following error was thrown: `SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client` --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 0d6c501a8..9dc61f205 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -60,6 +60,7 @@ services: restart: unless-stopped networks: - internal + command: --default-authentication-plugin=mysql_native_password environment: - MYSQL_DATABASE=pixelfed - MYSQL_USER=${DB_USERNAME} From d4e1123ea7180828d7773f65dd225af1ff16d915 Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Fri, 1 Nov 2019 19:55:04 +0100 Subject: [PATCH 3/5] docker: expose redis port so the app can connect to it --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 9dc61f205..c2ed23208 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,6 +72,8 @@ services: redis: image: redis:5-alpine restart: unless-stopped + ports: + - "6379:6379" volumes: - "redis-data:/data" networks: From c62978e192c94c497265a7fed3698dafdffe8204 Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Fri, 1 Nov 2019 21:03:40 +0100 Subject: [PATCH 4/5] docker: install mysqldump for backup This commit installs mysqldump via the package mariadb-client to make use of `php artisan backup:run`. Without that package the command fails with the following error: ``` $ docker-compose exec app php artisan backup:run Starting backup... Dumping database pixelfed... Backup failed because The dump process failed with exitcode 127 : Command not found : sh: 1: mysqldump: not found ``` --- contrib/docker/Dockerfile.apache | 2 +- contrib/docker/Dockerfile.fpm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/docker/Dockerfile.apache b/contrib/docker/Dockerfile.apache index 4e089faed..d6a364a51 100644 --- a/contrib/docker/Dockerfile.apache +++ b/contrib/docker/Dockerfile.apache @@ -8,7 +8,7 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends git gosu \ optipng pngquant jpegoptim gifsicle libpq-dev libsqlite3-dev locales zip unzip libzip-dev libcurl4-openssl-dev \ libfreetype6 libicu-dev libjpeg62-turbo libpng16-16 libxpm4 libwebp6 libmagickwand-6.q16-6 \ - libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libmagickwand-dev \ + libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libmagickwand-dev mariadb-client\ && sed -i '/en_US/s/^#//g' /etc/locale.gen \ && locale-gen && update-locale \ && docker-php-source extract \ diff --git a/contrib/docker/Dockerfile.fpm b/contrib/docker/Dockerfile.fpm index a402726a3..2b4b94416 100644 --- a/contrib/docker/Dockerfile.fpm +++ b/contrib/docker/Dockerfile.fpm @@ -8,7 +8,7 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends git gosu \ optipng pngquant jpegoptim gifsicle libpq-dev libsqlite3-dev locales zip unzip libzip-dev libcurl4-openssl-dev \ libfreetype6 libicu-dev libjpeg62-turbo libpng16-16 libxpm4 libwebp6 libmagickwand-6.q16-6 \ - libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libmagickwand-dev \ + libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libmagickwand-dev mariadb-client\ && sed -i '/en_US/s/^#//g' /etc/locale.gen \ && locale-gen && update-locale \ && docker-php-source extract \ From c864f4b2221c3b6e6555864eb5d189cb890a2797 Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Fri, 1 Nov 2019 23:58:50 +0100 Subject: [PATCH 5/5] docker: provide .env to the redis container, too --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index c2ed23208..e19334ad3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,6 +72,8 @@ services: redis: image: redis:5-alpine restart: unless-stopped + env_file: + - ./.env ports: - "6379:6379" volumes: