Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entrypoint: enable configuring PHP memory limit #374

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Default login is `wallabag:wallabag`.
- `-e SYMFONY__ENV__SENTRY_DSN=...` (defaults to "~", this is the data source name for sentry)
- `-e POPULATE_DATABASE=...`(defaults to "True". Does the DB has to be populated or is it an existing one)
- `-e SYMFONY__ENV__SERVER_NAME=...` (defaults to "Your wallabag instance". Specifies a user-friendly name for the 2FA issuer)
- `-e PHP_MEMORY_LIMIT=...` (allows you to change the PHP `memory_limit` value. defaults to 128M, and should be a number and unit, eg. 512K, 128M, 2G, or a number of bytes)

## SQLite

Expand Down
7 changes: 7 additions & 0 deletions root/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ provisioner() {
SYMFONY__ENV__DATABASE_DRIVER=${SYMFONY__ENV__DATABASE_DRIVER:-pdo_sqlite}
POPULATE_DATABASE=${POPULATE_DATABASE:-True}

# PHP configuration base and memory limit (default is 128M because that's what php.ini currently ships with)
PHP_CONF_BASE_DIR=`php --ini | head -n1 | sed 's/^.*: //'`
PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-128M}

# Replace environment variables
envsubst < /etc/wallabag/parameters.template.yml > app/config/parameters.yml

# Configure PHP memory limit
sed -i "s/memory_limit\s*=.*/memory_limit=${PHP_MEMORY_LIMIT}/g" $PHP_CONF_BASE_DIR/php.ini

# Wait for external database
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_mysql" ] || [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] ; then
wait_for_database
Expand Down