Skip to content

Commit

Permalink
Make the autoconfig filename configurable via env var
Browse files Browse the repository at this point in the history
And move it internally for easy bind mounting
  • Loading branch information
greenape committed May 16, 2024
1 parent c87ebd1 commit 6a43839
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]

### Added
- The file name of FlowDB's automatically generated at init config file can now be specified by setting the `AUTO_CONFIG_FILE_NAME` environment variable. By default this is `postgresql.configurator.conf`.

### Changed
- FlowDB now enables partitionwise aggregation planning by default
- The location inside the container of FlowDB's automatically generated config file has changed to `/flowdb_autoconf/$AUTO_CONFIG_FILE_NAME`.

### Fixed
- Queries that have multiple of the same subquery with different parameters no longer cause duplicate scopes in tokens. [#6580](https://github.com/Flowminder/FlowKit/issues/6580)
Expand Down
1 change: 1 addition & 0 deletions docs/source/administrator/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ You may also provide the following environment variables:
| EFFECTIVE_CACHE_SIZE | Postgres cache size | 25% of total RAM |
| FLOWDB_ENABLE_POSTGRES_DEBUG_MODE | When set to TRUE, enables use of the [pgadmin debugger](https://www.pgadmin.org/docs/pgadmin4/4.13/debugger.html) | FALSE |
| MAX_LOCKS_PER_TRANSACTION | Controls the maximum number of locks one transaction can take, you may wish to reduce this on low-memory servers. | 36500 |
| AUTO_CONFIG_FILE_NAME | The path in the container of the automatically generated config file located at /flowdb_autoconf | `postgresql.configurator.conf` |

However in most cases, the defaults will be adequate.

Expand Down
5 changes: 5 additions & 0 deletions flowdb.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ ENV FLOWAPI_FLOWDB_USER=flowapi
# Default location table
ENV LOCATION_TABLE=infrastructure.cells

# Default autoconfig file
ENV AUTO_CONFIG_FILE_NAME=postgresql.configurator.conf

#
# Copy file spinup build scripts to be execed.
#
Expand All @@ -152,5 +155,7 @@ COPY --chown=postgres ./flowdb/bin/build/* /docker-entrypoint-initdb.d/
ADD --chown=postgres ./flowdb/data/* /docker-entrypoint-initdb.d/data/csv/
# Need to make postgres owner
RUN chown -R postgres /docker-entrypoint-initdb.d
# Make postgres owner of the autoconf directory
RUN mkdir /flowdb_autoconf && chown -R postgres /flowdb_autoconf && chmod a+w /flowdb_autoconf

EXPOSE 5432
2 changes: 1 addition & 1 deletion flowdb/bin/build/0010_tweak_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set -e
# to have it off from the start for the benefit of the testdata containers
# for increased performance during startup.
python3 /docker-entrypoint-initdb.d/configurate.py
echo "include 'postgresql.configurator.conf'" >> /var/lib/postgresql/data/postgresql.conf
echo "include '/flowdb_autoconf/$AUTO_CONFIG_FILE_NAME'" >> /var/lib/postgresql/data/postgresql.conf
pg_ctl -D "$PGDATA" \
-o "-c listen_addresses=''" \
-w restart
4 changes: 1 addition & 3 deletions flowdb/bin/build/configurate.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def bool_env(var):
max_locks = int(os.getenv("MAX_LOCKS_PER_TRANSACTION", 365 * 5 * 4 * (1 + 4)))


config_path = os.getenv(
"AUTO_CONFIG_PATH", "/var/lib/postgresql/data/postgresql.configurator.conf"
)
config_path = f"/flowdb_autoconf/{os.getenv('AUTO_CONFIG_FILE_NAME', 'postgresql.configurator.conf')}"

preload_libraries = ["pg_stat_statements"]
if bool_env("FLOWDB_ENABLE_POSTGRES_DEBUG_MODE"):
Expand Down

0 comments on commit 6a43839

Please sign in to comment.