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

docker-entrypoint will now set default configs based on Neo4j Edition #192

Merged
merged 4 commits into from
Sep 12, 2019
Merged
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
49 changes: 22 additions & 27 deletions docker-image-src/3.3/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,18 @@ if [ "${NEO4J_EDITION}" == "enterprise" ];
then
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__listen__address:=${NEO4J_causalClustering_discoveryListenAddress:-"0.0.0.0:5000"}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__listen__address:=${NEO4J_causalClustering_transactionListenAddress:-"0.0.0.0:6000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__listen__address:=${NEO4J_causalClustering_raftListenAddress:-"0.0.0.0:7000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}
# Custom settings for dockerized neo4j
: ${NEO4J_ha_host_coordination:=$(hostname):5001}
: ${NEO4J_ha_host_data:=$(hostname):6001}
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}
fi
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}


# unset old hardcoded unsupported env variables
unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
Expand All @@ -254,18 +259,6 @@ unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
NEO4J_causalClustering_raftListenAddress \
NEO4J_causalClustering_raftAdvertisedAddress

# Custom settings for dockerized neo4j
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
: ${NEO4J_ha_host_coordination:=$(hostname):5001}
: ${NEO4J_ha_host_data:=$(hostname):6001}
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}
fi

if [ -d /conf ]; then
if secure_mode_enabled; then
check_mounted_folder_readable "/conf"
Expand Down Expand Up @@ -341,9 +334,10 @@ if [ "${cmd}" == "neo4j" ]; then
fi
fi

declare -A CONFIG
declare -A COMMUNITY
declare -A ENTERPRISE

CONFIG=(
COMMUNITY=(
[dbms.tx_log.rotation.retention_policy]="100M size"
[dbms.memory.pagecache.size]="512M"
[dbms.connectors.default_listen_address]="0.0.0.0"
Expand All @@ -352,27 +346,28 @@ CONFIG=(
[dbms.connector.bolt.listen_address]="0.0.0.0:7687"
)

for conf in ${!CONFIG[@]} ; do

if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${CONFIG[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
done

declare -A ENTERPRISE

ENTERPRISE=(
[causal_clustering.transaction_listen_address]="0.0.0.0:6000"
[causal_clustering.raft_listen_address]="0.0.0.0:7000"
[causal_clustering.discovery_listen_address]="0.0.0.0:5000"
)

for conf in ${!COMMUNITY[@]} ; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're missing the equivalent of this for for enterprise. Maybe a patching error?


if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${COMMUNITY[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
done

for conf in ${!ENTERPRISE[@]} ; do

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${ENTERPRISE[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
fi
done

Expand Down
55 changes: 35 additions & 20 deletions docker-image-src/3.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,22 @@ fi
: ${NEO4J_dbms_connectors_default__advertised__address:=${NEO4J_dbms_connectors_defaultAdvertisedAddress:-}}
: ${NEO4J_ha_server__id:=${NEO4J_ha_serverId:-}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HA configurations are also enterprise specific, these configs that contain ha should be inside your if statement. This applies to versions 3.3 and 3.4 of the docker entrypoint.
Since it was deprecated in 3.5 we shouldn't be setting HA configs (default or otherwise) in the entrypoints for 3.5 and onwards (they might be set in the conf file but there's not much we can do about that).

: ${NEO4J_ha_initial__hosts:=${NEO4J_ha_initialHosts:-}}
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__listen__address:=${NEO4J_causalClustering_discoveryListenAddress:-"0.0.0.0:5000"}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__listen__address:=${NEO4J_causalClustering_transactionListenAddress:-"0.0.0.0:6000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__listen__address:=${NEO4J_causalClustering_raftListenAddress:-"0.0.0.0:7000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}
# Custom settings for dockerized neo4j
: ${NEO4J_ha_host_coordination:=$(hostname):5001}
: ${NEO4J_ha_host_data:=$(hostname):6001}
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}
fi
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}

# unset old hardcoded unsupported env variables
unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
Expand All @@ -250,14 +258,6 @@ unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
NEO4J_causalClustering_raftListenAddress \
NEO4J_causalClustering_raftAdvertisedAddress

# Custom settings for dockerized neo4j
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}
: ${NEO4J_ha_host_coordination:=$(hostname):5001}
: ${NEO4J_ha_host_data:=$(hostname):6001}
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}

if [ -d /conf ]; then
if secure_mode_enabled; then
check_mounted_folder_readable "/conf"
Expand Down Expand Up @@ -333,25 +333,40 @@ if [ "${cmd}" == "neo4j" ]; then
fi
fi

declare -A CONFIG
declare -A COMMUNITY
declare -A ENTERPRISE

CONFIG=(
COMMUNITY=(
[dbms.tx_log.rotation.retention_policy]="100M size"
[dbms.memory.pagecache.size]="512M"
[dbms.connectors.default_listen_address]="0.0.0.0"
[dbms.connector.https.listen_address]="0.0.0.0:7473"
[dbms.connector.http.listen_address]="0.0.0.0:7474"
[dbms.connector.bolt.listen_address]="0.0.0.0:7687"
)

ENTERPRISE=(
[causal_clustering.transaction_listen_address]="0.0.0.0:6000"
[causal_clustering.raft_listen_address]="0.0.0.0:7000"
[causal_clustering.discovery_listen_address]="0.0.0.0:5000"
)

for conf in ${!CONFIG[@]} ; do
for conf in ${!COMMUNITY[@]} ; do

if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${CONFIG[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
echo -e "\n"$conf=${COMMUNITY[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
done

for conf in ${!ENTERPRISE[@]} ; do

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${ENTERPRISE[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
fi
done

Expand Down
56 changes: 34 additions & 22 deletions docker-image-src/3.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,21 @@ fi
: ${NEO4J_dbms_unmanaged__extension__classes:=${NEO4J_dbms_unmanagedExtensionClasses:-}}
: ${NEO4J_dbms_allow__format__migration:=${NEO4J_dbms_allowFormatMigration:-}}
: ${NEO4J_dbms_connectors_default__advertised__address:=${NEO4J_dbms_connectors_defaultAdvertisedAddress:-}}
: ${NEO4J_ha_server__id:=${NEO4J_ha_serverId:-}}
: ${NEO4J_ha_initial__hosts:=${NEO4J_ha_initialHosts:-}}
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__listen__address:=${NEO4J_causalClustering_discoveryListenAddress:-"0.0.0.0:5000"}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__listen__address:=${NEO4J_causalClustering_transactionListenAddress:-"0.0.0.0:6000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__listen__address:=${NEO4J_causalClustering_raftListenAddress:-"0.0.0.0:7000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}
# Custom settings for dockerized neo4j
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}
fi
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}


# unset old hardcoded unsupported env variables
unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
Expand All @@ -250,14 +255,6 @@ unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
NEO4J_causalClustering_raftListenAddress \
NEO4J_causalClustering_raftAdvertisedAddress

# Custom settings for dockerized neo4j
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}
: ${NEO4J_ha_host_coordination:=$(hostname):5001}
: ${NEO4J_ha_host_data:=$(hostname):6001}
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}

if [ -d /conf ]; then
if secure_mode_enabled; then
check_mounted_folder_readable "/conf"
Expand Down Expand Up @@ -333,25 +330,40 @@ if [ "${cmd}" == "neo4j" ]; then
fi
fi

declare -A CONFIG
declare -A COMMUNITY
declare -A ENTERPRISE

CONFIG=(
COMMUNITY=(
[dbms.tx_log.rotation.retention_policy]="100M size"
[dbms.memory.pagecache.size]="512M"
[dbms.connectors.default_listen_address]="0.0.0.0"
[dbms.connector.https.listen_address]="0.0.0.0:7473"
[dbms.connector.http.listen_address]="0.0.0.0:7474"
[dbms.connector.bolt.listen_address]="0.0.0.0:7687"
)

ENTERPRISE=(
[causal_clustering.transaction_listen_address]="0.0.0.0:6000"
[causal_clustering.raft_listen_address]="0.0.0.0:7000"
[causal_clustering.discovery_listen_address]="0.0.0.0:5000"
)

for conf in ${!CONFIG[@]} ; do
for conf in ${!COMMUNITY[@]} ; do

if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${CONFIG[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
echo -e "\n"$conf=${COMMUNITY[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
done

for conf in ${!ENTERPRISE[@]} ; do

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${ENTERPRISE[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
fi
done

Expand Down
56 changes: 34 additions & 22 deletions docker-image-src/4.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,21 @@ fi
: ${NEO4J_dbms_unmanaged__extension__classes:=${NEO4J_dbms_unmanagedExtensionClasses:-}}
: ${NEO4J_dbms_allow__format__migration:=${NEO4J_dbms_allowFormatMigration:-}}
: ${NEO4J_dbms_connectors_default__advertised__address:=${NEO4J_dbms_connectors_defaultAdvertisedAddress:-}}
: ${NEO4J_ha_server__id:=${NEO4J_ha_serverId:-}}
: ${NEO4J_ha_initial__hosts:=${NEO4J_ha_initialHosts:-}}
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__listen__address:=${NEO4J_causalClustering_discoveryListenAddress:-"0.0.0.0:5000"}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__listen__address:=${NEO4J_causalClustering_transactionListenAddress:-"0.0.0.0:6000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__listen__address:=${NEO4J_causalClustering_raftListenAddress:-"0.0.0.0:7000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
: ${NEO4J_causal__clustering_expected__core__cluster__size:=${NEO4J_causalClustering_expectedCoreClusterSize:-}}
: ${NEO4J_causal__clustering_initial__discovery__members:=${NEO4J_causalClustering_initialDiscoveryMembers:-}}
: ${NEO4J_causal__clustering_discovery__advertised__address:=${NEO4J_causalClustering_discoveryAdvertisedAddress:-"$(hostname):5000"}}
: ${NEO4J_causal__clustering_transaction__advertised__address:=${NEO4J_causalClustering_transactionAdvertisedAddress:-"$(hostname):6000"}}
: ${NEO4J_causal__clustering_raft__advertised__address:=${NEO4J_causalClustering_raftAdvertisedAddress:-"$(hostname):7000"}}
# Custom settings for dockerized neo4j
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}
fi
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}


# unset old hardcoded unsupported env variables
unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
Expand All @@ -250,14 +255,6 @@ unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \
NEO4J_causalClustering_raftListenAddress \
NEO4J_causalClustering_raftAdvertisedAddress

# Custom settings for dockerized neo4j
: ${NEO4J_wrapper_java_additional:=-Dneo4j.ext.udc.source=docker}
: ${NEO4J_ha_host_coordination:=$(hostname):5001}
: ${NEO4J_ha_host_data:=$(hostname):6001}
: ${NEO4J_causal__clustering_discovery__advertised__address:=$(hostname):5000}
: ${NEO4J_causal__clustering_transaction__advertised__address:=$(hostname):6000}
: ${NEO4J_causal__clustering_raft__advertised__address:=$(hostname):7000}

if [ -d /conf ]; then
if secure_mode_enabled; then
check_mounted_folder_readable "/conf"
Expand Down Expand Up @@ -333,25 +330,40 @@ if [ "${cmd}" == "neo4j" ]; then
fi
fi

declare -A CONFIG
declare -A COMMUNITY
declare -A ENTERPRISE

CONFIG=(
COMMUNITY=(
[dbms.tx_log.rotation.retention_policy]="100M size"
[dbms.memory.pagecache.size]="512M"
[dbms.connectors.default_listen_address]="0.0.0.0"
[dbms.connector.https.listen_address]="0.0.0.0:7473"
[dbms.connector.http.listen_address]="0.0.0.0:7474"
[dbms.connector.bolt.listen_address]="0.0.0.0:7687"
)

ENTERPRISE=(
[causal_clustering.transaction_listen_address]="0.0.0.0:6000"
[causal_clustering.raft_listen_address]="0.0.0.0:7000"
[causal_clustering.discovery_listen_address]="0.0.0.0:5000"
)

for conf in ${!CONFIG[@]} ; do
for conf in ${!COMMUNITY[@]} ; do

if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${CONFIG[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
echo -e "\n"$conf=${COMMUNITY[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
done

for conf in ${!ENTERPRISE[@]} ; do

if [ "${NEO4J_EDITION}" == "enterprise" ];
then
if ! grep -q "^$conf" "${NEO4J_HOME}"/conf/neo4j.conf
then
echo -e "\n"$conf=${ENTERPRISE[$conf]} >> "${NEO4J_HOME}"/conf/neo4j.conf
fi
fi
done

Expand Down
Loading