-
Notifications
You must be signed in to change notification settings - Fork 63
Add redis to docker compose #216
Changes from 10 commits
40c4764
b32a7a5
c247288
c3eda47
7426fa8
7c97d49
0bab29e
e4fc17b
52acd2f
925dc97
648b6f4
9b73165
48c2f3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # ID to uses in docker file. | ||
| PUID=1000 | ||
| PGID=1000 | ||
|
|
||
| # Timezone of the application. | ||
| TIMEZONE=UTC | ||
|
|
||
| # If `SKIP_PERMISSIONS_CHECKS` is set to "yes", the entrypoint script will not check or set the permissions of files and directories on startup. | ||
| # SKIP_PERMISSIONS_CHECKS=false | ||
|
|
||
| # Set up the cache driver, use either "redis" or "file" | ||
| # CACHE_DRIVER=redis | ||
|
|
||
| # It is safer to use file cache driver for the log viewer. | ||
| # That way, if your application is running Redis and crashes, you will still be able to access the logs. | ||
| LOG_VIEWER_CACHE_DRIVER=file | ||
|
|
||
| # Default app URL | ||
| # APP_URL=http://localhost | ||
|
|
||
| # Redis configuration | ||
| # REDIS_PORT=6379 | ||
| # REDIS_USERNAME=default | ||
| # REDIS_PASSWORD= | ||
| # REDIS_HOST=lychee_redis | ||
|
|
||
| # Database configuration | ||
| # DB_ROOT_PASSWORD=rootpassword | ||
| # DB_DATABASE=lychee | ||
| # DB_USERNAME=lychee | ||
| # DB_PASSWORD=lychee |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,14 +13,17 @@ | |
|
|
||
| ## Table of Contents | ||
| <!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --> | ||
| - [Image content](#image-content) | ||
| - [Notice: Dockerhub repository has been migrated to lycheeorg/lychee](#notice-dockerhub-repository-has-been-migrated-to-lycheeorglychee) | ||
|
||
| - [Table of Contents](#table-of-contents) | ||
| - [Image Content](#image-content) | ||
| - [Setup](#setup) | ||
| - [Quick Start](#quick-start) | ||
| - [Prerequisites](#prerequisites) | ||
| - [Run with Docker](#run-with-docker) | ||
| - [Run with Docker Compose](#run-with-docker-compose) | ||
| - [Create admin account during first run](#create-admin-account-during-first-run) | ||
| - [Docker secrets](#docker-secrets) | ||
| - [Available environment variables and defaults](#available-environment-variables-and-defaults) | ||
| - [Advanced configuration](#advanced-configuration) | ||
| <!-- /TOC --> | ||
|
|
||
| ## Image Content | ||
|
|
@@ -91,9 +94,19 @@ alter user 'lychee' identified with mysql_native_password by '<your password>'; | |
|
|
||
| ### Run with Docker Compose | ||
|
|
||
| Change the environment variables in the [provided example](./docker-compose.yml) to reflect your database credentials. | ||
| You can take the provided docker-compose.yml example as a start and edit it to enable more configuration variables. | ||
|
|
||
| Note that in order to avoid writing credentials directly into the file, you can create a `db_secrets.env` and use the `env_file` directive (see the [docs](https://docs.docker.com/compose/environment-variables/#the-env_file-configuration-option)). | ||
| Use the `.env.exanple` to create a `.env` at the root of your folder containing your `docker-compose.yml`. | ||
| Populate your database credentials and other environment variables. | ||
|
|
||
| This `.env` file will be loaded by docker compose and populate environment in the docker container. | ||
| Those will then be injected in the Lychee configuration file (located in e.g. `lychee/config/.env`). | ||
|
|
||
|  | ||
|
|
||
| :warning: If you later edit your `lychee/config/.env` file, restarting the container will overwrite with the variables provided in your docker-compose `.env` file. | ||
| For this reason it is better to make your changes directly in `docker-compose.yml`/`.env` rather than in `lychee/config/.env` when the values are supported. | ||
| Please refer to the [inject.sh](https://github.com/LycheeOrg/Lychee/blob/master/inject.sh) script for more details. | ||
|
|
||
| ### Create admin account during first run | ||
|
|
||
|
|
@@ -114,7 +127,7 @@ The following _FILE variables are supported: | |
|
|
||
| ## Available environment variables and defaults | ||
|
|
||
| If you do not provide environment variables or `.env` file, the [example .env file](https://github.com/LycheeOrg/Lychee/blob/master/.env.example) will be used with some values already set by default. | ||
| If you do not provide environment variables or `.env` file, the [example .env file](https://github.com/LycheeOrg/Lychee/blob/master/.env.example) will be used with some values already set by default inside the docker container. | ||
ildyria marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Some variables are specific to Docker, and the default values are : | ||
|
|
||
|
|
@@ -126,22 +139,6 @@ Some variables are specific to Docker, and the default values are : | |
|
|
||
| Additionally, if `SKIP_PERMISSIONS_CHECKS` is set to "yes", the entrypoint script will not check or set the permissions of files and directories on startup. Users are strongly advised **against** using this option, and efforts have been made to keep the checks as fast as possible. Nonetheless, it may be suitable for some advanced use cases. | ||
|
|
||
| ## Advanced configuration | ||
|
|
||
| Note that nginx will accept by default images up to 100MB (`client_max_body_size 100M`) and that PHP parameters are overridden according to the [recommendations of the Lychee FAQ](https://lycheeorg.github.io/docs/faq.html#i-cant-upload-large-photos). | ||
|
|
||
| You may still want to further customize PHP configuration. The first method is to mount a custom `php.ini` to `/etc/php/8.2/fpm/php.ini` when starting the container. However, this method is kind of brutal as it will override all parameters. It will also need to be remapped whenever an image is released with a new version of PHP. | ||
|
|
||
| Instead, we recommend to use the `PHP_VALUE` directive of PHP-FPM to override specific parameters. To do so, you will need to mount a custom `nginx.conf` in your container : | ||
|
|
||
| 1. Take the [default.conf](./default.conf) file as a base | ||
| 2. Find the line starting by `fastcgi_param PHP_VALUE [...]` | ||
| 3. Add a new line and set your new parameter | ||
| 4. Add or change any other parameters (e.g. `client_max_body_size`) | ||
| 5. Mount your new file to `/etc/nginx/nginx.conf` | ||
|
|
||
| If you need to add (not change) nginx directives, files mounted in `/etc/nginx/conf.d/` will be included in the `http` context. | ||
|
|
||
|
Comment on lines
-129
to
-144
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going to object to this, but I guess these overrides aren't really needed any more (unless someone really knows what they're doing, and so can figure it out easily enough).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about it, the main reason I am dropping it is because Lychee now supports upload by chunks, as a result the limit on post request is no longer an issue for large files. :) |
||
| [arm64-shield]: https://img.shields.io/badge/arm64-yes-success.svg?style=flat | ||
| [amd64-shield]: https://img.shields.io/badge/amd64-yes-success.svg?style=flat | ||
| [armv7-shield]: https://img.shields.io/badge/armv7-yes-success.svg?style=flat | ||
|
|
||
ildyria marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,33 @@ | |
| #------------------------------------------- | ||
|
|
||
| services: | ||
| lychee_cache: | ||
| image: redis:alpine | ||
| container_name: lychee_redis | ||
| hostname: lychee_redis | ||
| security_opt: | ||
| - no-new-privileges:true | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "redis-cli ping || exit 1"] | ||
| ports: | ||
| - ${REDIS_PORT:-6379}:${REDIS_PORT:-6379} | ||
| user: 1026:100 | ||
| environment: | ||
| - TZ=${TIMEZONE:-UTC} | ||
| networks: | ||
| - lychee | ||
| volumes: | ||
| - cache:/data:rw | ||
| restart: on-failure:5 | ||
|
|
||
| lychee_db: | ||
| container_name: lychee_db | ||
| image: mariadb:10 | ||
| environment: | ||
| - MYSQL_ROOT_PASSWORD=<ROOT_PASSWORD> | ||
| - MYSQL_DATABASE=lychee | ||
| - MYSQL_USER=lychee | ||
| - MYSQL_PASSWORD=<LYCHEE_PASSWORD> | ||
| - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-rootpassword} | ||
| - MYSQL_DATABASE=${DB_DATABASE:-lychee} | ||
| - MYSQL_USER=${DB_USERNAME:-lychee} | ||
| - MYSQL_PASSWORD=${DB_PASSWORD} | ||
| expose: | ||
| - 3306 | ||
| volumes: | ||
|
|
@@ -22,7 +41,7 @@ services: | |
| restart: unless-stopped | ||
|
|
||
| lychee: | ||
| image: lycheeorg/lychee | ||
| image: lycheeorg/lychee:nightly | ||
| container_name: lychee | ||
| ports: | ||
| - 90:80 | ||
|
|
@@ -38,13 +57,13 @@ services: | |
| #- PUID=1000 | ||
| #- PGID=1000 | ||
| # PHP timezone e.g. PHP_TZ=America/New_York | ||
| - PHP_TZ=UTC | ||
| - TIMEZONE=UTC | ||
| - PHP_TZ=${TIMEZONE:-UTC} | ||
| - TIMEZONE=${TIMEZONE:-UTC} | ||
| #- APP_NAME=Laravel | ||
| #- APP_ENV=local | ||
| #- APP_DEBUG=true | ||
| #- APP_FORCE_HTTPS=false | ||
| #- APP_URL=http://localhost | ||
| - APP_URL=${APP_URL:-http://localhost} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already the default - does this one not pass through?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it makes it easier to modify in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it's an env value, so wouldn't it work when modified in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you mean ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the idea was that setting |
||
| #- APP_DIR= | ||
| #- DEBUGBAR_ENABLEd=false | ||
| #- VUEJS_ENABLED=true | ||
|
|
@@ -53,10 +72,10 @@ services: | |
| #- DB_OLD_LYCHEE_PREFIX='' | ||
| - DB_CONNECTION=mysql | ||
| - DB_HOST=lychee_db | ||
| - DB_PORT=3306 | ||
| - DB_DATABASE=lychee | ||
| - DB_USERNAME=lychee | ||
| - DB_PASSWORD=<LYCHEE_PASSWORD> | ||
| - DB_PORT=${DB_PORT:-3306} | ||
| - DB_DATABASE=${DB_DATABASE:-lychee} | ||
| - DB_USERNAME=${DB_USERNAME:-lychee} | ||
| - DB_PASSWORD=${DB_PASSWORD} | ||
| #- DB_PASSWORD_FILE=<filename> | ||
| #- DB_LOG_SQL=false | ||
| #- DB_LOG_SQL_EXPLAIN=false | ||
|
|
@@ -79,16 +98,17 @@ services: | |
| #- MAIL_FROM_NAME= | ||
| #- MAIL_FROM_ADDRESS= | ||
| #- TRUSTED_PROXIES= | ||
| #- SKIP_PERMISSIONS_CHECKS | ||
| - SKIP_PERMISSIONS_CHECKS=${SKIP_PERMISSIONS_CHECKS:-false} | ||
d7415 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - STARTUP_DELAY=30 | ||
| #- ADMIN_USER=admin | ||
| #- ADMIN_PASSWORD=<ADMIN_PASSWORD> | ||
| #- ADMIN_PASSWORD_FILE=<filename> | ||
| ### Unused in Lychee | ||
| #- REDIS_HOST=127.0.0.1 | ||
| #- REDIS_PASSWORD=null | ||
| #- REDIS_PASSWORD_FILE=<filename> | ||
| #- REDIS_PORT=6379 | ||
| - CACHE_DRIVER=${CACHE_DRIVER:-redis} | ||
| - REDIS_URL=redis://${REDIS_USERNAME:-default}:${REDIS_PASSWORD:-}@${REDIS_HOST:-lychee_redis}:${REDIS_PORT:-6379} | ||
ildyria marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - REDIS_HOST=${REDIS_HOST:-lychee_redis} | ||
| - REDIS_PORT=${REDIS_PORT:-6379} | ||
| - REDIS_PASSWORD=${REDIS_PASSWORD:-} | ||
| - LOG_VIEWER_CACHE_DRIVER=${LOG_VIEWER_CACHE_DRIVER:-file} | ||
ildyria marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| restart: unless-stopped | ||
| depends_on: | ||
| - lychee_db | ||
|
|
@@ -98,3 +118,8 @@ networks: | |
|
|
||
| volumes: | ||
| mysql: | ||
| name: lychee_prod_mysql | ||
| driver: local | ||
| cache: | ||
| name: lychee_prod_redis | ||
| driver: local | ||
Uh oh!
There was an error while loading. Please reload this page.